You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(248) |
May
(82) |
Jun
(90) |
Jul
(177) |
Aug
(253) |
Sep
(157) |
Oct
(151) |
Nov
(143) |
Dec
(278) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(152) |
Feb
(107) |
Mar
(177) |
Apr
(133) |
May
(259) |
Jun
(81) |
Jul
(119) |
Aug
(306) |
Sep
(416) |
Oct
(240) |
Nov
(329) |
Dec
(206) |
2006 |
Jan
(466) |
Feb
(382) |
Mar
(153) |
Apr
(162) |
May
(133) |
Jun
(21) |
Jul
(18) |
Aug
(37) |
Sep
(97) |
Oct
(114) |
Nov
(110) |
Dec
(28) |
2007 |
Jan
(74) |
Feb
(65) |
Mar
(49) |
Apr
(76) |
May
(43) |
Jun
(15) |
Jul
(68) |
Aug
(55) |
Sep
(63) |
Oct
(59) |
Nov
(70) |
Dec
(66) |
2008 |
Jan
(71) |
Feb
(60) |
Mar
(120) |
Apr
(31) |
May
(48) |
Jun
(81) |
Jul
(107) |
Aug
(51) |
Sep
(80) |
Oct
(83) |
Nov
(83) |
Dec
(79) |
2009 |
Jan
(83) |
Feb
(110) |
Mar
(97) |
Apr
(91) |
May
(291) |
Jun
(250) |
Jul
(197) |
Aug
(58) |
Sep
(54) |
Oct
(122) |
Nov
(68) |
Dec
(34) |
2010 |
Jan
(50) |
Feb
(17) |
Mar
(63) |
Apr
(61) |
May
(84) |
Jun
(81) |
Jul
(138) |
Aug
(144) |
Sep
(78) |
Oct
(26) |
Nov
(30) |
Dec
(61) |
2011 |
Jan
(33) |
Feb
(35) |
Mar
(166) |
Apr
(221) |
May
(109) |
Jun
(76) |
Jul
(27) |
Aug
(37) |
Sep
(1) |
Oct
(4) |
Nov
(2) |
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2013 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(1) |
2014 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Michael D. <mik...@us...> - 2004-10-29 05:58:21
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17342/NHibernate/Cfg Modified Files: Binder.cs Configuration.cs Environment.cs Mappings.cs Added Files: Settings.cs SettingsFactory.cs Log Message: NH-90 : code for a pluggable cache. Added a Settings class and removed some old hibernate properties that don't apply to .net. Index: Mappings.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Mappings.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Mappings.cs 22 Aug 2004 06:24:26 -0000 1.8 --- Mappings.cs 29 Oct 2004 05:58:06 -0000 1.9 *************** *** 1,4 **** --- 1,6 ---- using System; using System.Collections; + + using NHibernate.Cache; using NHibernate.Mapping; *************** *** 8,11 **** --- 10,14 ---- /// A collection of mappings from classes and collections to relational database tables. /// </summary> + /// <remarks>Represents a single <c><hibernate-mapping></c> element.</remarks> public class Mappings { *************** *** 22,27 **** private bool autoImport; private string defaultAccess; ! internal Mappings(IDictionary classes, IDictionary collections, IDictionary tables, IDictionary queries, IDictionary imports, IList secondPasses) { this.classes = classes; --- 25,31 ---- private bool autoImport; private string defaultAccess; + private IDictionary caches; ! internal Mappings(IDictionary classes, IDictionary collections, IDictionary tables, IDictionary queries, IDictionary imports, IDictionary caches, IList secondPasses) { this.classes = classes; *************** *** 30,36 **** --- 34,57 ---- this.tables = tables; this.imports = imports; + this.caches = caches; this.secondPasses = secondPasses; } + /// <summary> + /// Associates the class name with the cache strategy. + /// </summary> + /// <param name="name">The classname of the class to cache.</param> + /// <param name="cache">The <see cref="ICacheConcurrencyStrategy"/> to use for caching.</param> + /// <exception cref="MappingException">Thrown when <c>name</c> already has a <c>cache</c> associated with it.</exception> + public void AddCache(string name, ICacheConcurrencyStrategy cache) + { + object old = caches[ name ]; + if( old!=null ) + { + throw new MappingException( "duplicate cache region" ); + } + caches[ name ] = cache; + } + public void AddClass(PersistentClass persistentClass) { Index: Binder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Binder.cs,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** Binder.cs 14 Oct 2004 04:33:13 -0000 1.32 --- Binder.cs 29 Oct 2004 05:58:06 -0000 1.33 *************** *** 4,7 **** --- 4,8 ---- using System.Xml; + using NHibernate.Cache; using NHibernate.Engine; using NHibernate.Loader; *************** *** 11,17 **** using NHibernate.Util; ! namespace NHibernate.Cfg { ! ! internal class Binder { private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Binder)); --- 12,19 ---- using NHibernate.Util; ! namespace NHibernate.Cfg ! { ! internal class Binder ! { private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Binder)); *************** *** 275,282 **** case "jcs-cache": ! model.Cache = Configuration.CreateCache( ! subnode.Attributes["usage"].Value, ! model.PersistentClazz.Name, ! model ); break; --- 277,284 ---- case "jcs-cache": ! string className = model.PersistentClazz.FullName; ! ICacheConcurrencyStrategy cache = CacheFactory.CreateCache( subnode, className, model.IsMutable ); ! mappings.AddCache( className, cache ); ! model.Cache = cache; break; *************** *** 1132,1139 **** else if ( "jcs-cache".Equals(name) ) { ! model.Cache = Configuration.CreateCache( ! subnode.Attributes["usage"].Value, ! model.Role, ! model.Owner ); } } --- 1134,1144 ---- else if ( "jcs-cache".Equals(name) ) { ! ICacheConcurrencyStrategy cache = CacheFactory.CreateCache( subnode, model.Role, model.Owner.IsMutable ); ! mappings.AddCache( model.Role, cache ); ! model.Cache = cache; ! // model.Cache = Configuration.CreateCache( ! // subnode.Attributes["usage"].Value, ! // model.Role, ! // model.Owner ); } } Index: Configuration.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Configuration.cs,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Configuration.cs 28 Sep 2004 01:08:40 -0000 1.21 --- Configuration.cs 29 Oct 2004 05:58:06 -0000 1.22 *************** *** 43,46 **** --- 43,47 ---- private IInterceptor interceptor = EmptyInterceptor; private IDictionary properties = Environment.Properties; + private IDictionary caches = new Hashtable(); private XmlSchema mappingSchema; *************** *** 208,212 **** public Mappings CreateMappings() { ! return new Mappings(classes, collections, tables, namedQueries, imports, secondPasses); } --- 209,213 ---- public Mappings CreateMappings() { ! return new Mappings(classes, collections, tables, namedQueries, imports, caches, secondPasses); } *************** *** 608,612 **** copy.Add(de.Key, de.Value); } ! return new SessionFactoryImpl(this, copy, interceptor); } --- 609,626 ---- copy.Add(de.Key, de.Value); } ! ! Settings settings = BuildSettings(); ! ConfigureCaches( settings ); ! ! return new SessionFactoryImpl( this, copy, interceptor, settings ); ! } ! ! /// <summary> ! /// Builds an object-oriented view of the settings. ! /// </summary> ! /// <returns>A <see cref="Settings"/> object initialized from the settings properties.</returns> ! protected Settings BuildSettings() ! { ! return SettingsFactory.BuildSettings( properties ); } *************** *** 800,823 **** } ! public static ICacheConcurrencyStrategy CreateCache(string usage, string name, PersistentClass owner) { ! log.Info("creating cache region: " + name + ", usage: " + usage); ! ICache cache = new HashtableCache(name); ! switch (usage) { ! case "read-only": ! if (owner.IsMutable) log.Warn("read-only cache configured for mutable: " + name); ! return new ReadOnlyCache(cache); ! ! case "read-write": ! return new ReadWriteCache(cache); ! ! case "nonstrict-read-write": ! return new NonstrictReadWriteCache(cache); ! ! default: ! throw new MappingException("jcs-cache usage attribute should be read-only, read-write, or nonstrict-read-write only"); } --- 814,845 ---- } ! //TODO: make properties a Settings class ! protected void ConfigureCaches(Settings settings) { ! log.Info( "instantiating and configuring caches" ); ! // TODO: add ability to configure cache_region_prefix ! foreach( DictionaryEntry de in caches ) { ! string name = (string)de.Key; ! ICacheConcurrencyStrategy strategy = (ICacheConcurrencyStrategy)de.Value; ! ! if( log.IsDebugEnabled ) ! { ! log.Debug( "instantiating cache " + name ); ! } ! ! ICache cache; ! try ! { ! cache = settings.CacheProvider.BuildCache( name, properties ); ! } ! catch( CacheException ce ) ! { ! throw new HibernateException( "Could not instantiate Cache", ce ); ! } ! ! strategy.Cache = cache; } Index: Environment.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Environment.cs,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Environment.cs 24 Sep 2004 03:31:25 -0000 1.19 --- Environment.cs 29 Oct 2004 05:58:06 -0000 1.20 *************** *** 46,64 **** public const string QuerySubstitutions = "hibernate.query.substitutions"; public const string QueryImports = "hibernate.query.imports"; - // MikeD added these while synching up SessionFactoryImpl. Not sure if they have any ado.net - // equivalents - we can probably remove these and remove the SessionFactoryImpl code that - // uses them. - [Obsolete("Removing ConnectionPool from NH")] - public const string PoolSize = "hibernate.connection.pool_size"; - public const string StatementBatchSize = "hibernate.jdbc.batch_size"; - public const string StatementFetchSize = "hibernate.jdbc.fetch_size"; - public const string UseScrollableResultSet = "hibernate.jdbc.use_scrollable_resultset"; - - // going to remove this - the DataProvider should implement their own IDbCommand - // caching, not NHibernate - [Obsolete("Removing StatementCache from NH")] - public const string StatementCacheSize = "hibernate.statement_cache.size"; - static Environment() { --- 46,51 ---- public const string QuerySubstitutions = "hibernate.query.substitutions"; public const string QueryImports = "hibernate.query.imports"; + public const string CacheProvider = "hibernate.cache.provider_class"; static Environment() { --- NEW FILE: Settings.cs --- using System; using System.Collections; using System.Data; using NHibernate.Cache; using NHibernate.Connection; using NHibernate.Dialect; using NHibernate.Transaction; namespace NHibernate.Cfg { /// <summary> /// Settings that affect the behavior of NHibernate at runtime. /// </summary> public sealed class Settings { private bool _isShowSqlEnabled; private bool _isOuterJoinFetchEnabled; private IDictionary _querySubstitutions; private Dialect.Dialect _dialect; private IsolationLevel _isolationLevel; private IConnectionProvider _connectionProvider; private ITransactionFactory _transactionFactory; private string _sessionFactoryName; private ICacheProvider _cacheProvider; private string _defaultSchemaName; public bool IsShowSqlEnabled { get { return _isShowSqlEnabled; } set { _isShowSqlEnabled = value; } } public bool IsOuterJoinFetchEnabled { get { return _isOuterJoinFetchEnabled; } set { _isOuterJoinFetchEnabled = value; } } public IDictionary QuerySubstitutions { get { return _querySubstitutions; } set { _querySubstitutions = value; } } public Dialect.Dialect Dialect { get { return _dialect; } set { _dialect = value; } } // some other ones in here I don't think will be added public string DefaultSchemaName { get { return _defaultSchemaName; } set { _defaultSchemaName = value; } } public IsolationLevel IsolationLevel { get { return _isolationLevel; } set { _isolationLevel = value; } } public IConnectionProvider ConnectionProvider { get { return _connectionProvider; } set { _connectionProvider = value; } } public ITransactionFactory TransactionFactory { get { return _transactionFactory; } set { _transactionFactory = value; } } public string SessionFactoryName { get { return _sessionFactoryName; } set { _sessionFactoryName = value; } } public ICacheProvider CacheProvider { get { return _cacheProvider; } set { _cacheProvider = value; } } } } --- NEW FILE: SettingsFactory.cs --- using System; using System.Collections; using System.Data; using System.Text; using NHibernate.Cache; using NHibernate.Connection; using NHibernate.Dialect; using NHibernate.Transaction; using NHibernate.Util; namespace NHibernate.Cfg { /// <summary> /// Reads configuration properties and configures a <see cref="Settings"/> instance. /// </summary> public sealed class SettingsFactory { private static readonly log4net.ILog log = log4net.LogManager.GetLogger( typeof(SettingsFactory) ); private SettingsFactory() { //should not be publically creatable } public static Settings BuildSettings(IDictionary properties) { Settings settings = new Settings(); Dialect.Dialect dialect = null; try { dialect = Dialect.Dialect.GetDialect( properties ); IDictionary temp = new Hashtable(); foreach( DictionaryEntry de in dialect.DefaultProperties ) { temp[ de.Key ] = de.Value; } foreach( DictionaryEntry de in properties ) { temp[ de.Key ] = de.Value; } properties = temp; } catch( HibernateException he ) { log.Warn( "No dialect set - using GenericDialect: " + he.Message ); dialect = new GenericDialect(); } bool useOuterJoin = PropertiesHelper.GetBoolean(Cfg.Environment.OuterJoin, properties, true); log.Info( "use outer join fetching: " + useOuterJoin ); IConnectionProvider connectionProvider = ConnectionProviderFactory.NewConnectionProvider(properties); ITransactionFactory transactionFactory = new TransactionFactory(); //Transaction BuildTransactionFactory(properties); string isolationString = PropertiesHelper.GetString( Cfg.Environment.Isolation, properties, String.Empty ); IsolationLevel isolation = IsolationLevel.Unspecified; if( isolationString.Length > 0) { try { isolation = (IsolationLevel)Enum.Parse( typeof(IsolationLevel), isolationString ); log.Info( "Using Isolation Level: " + isolation.ToString() ); } catch( ArgumentException ae ) { log.Error( "error configuring IsolationLevel " + isolationString, ae ); throw new HibernateException( "The isolation level of " + isolationString + " is not a valid IsolationLevel. Please " + "use one of the Member Names from the IsolationLevel.", ae ); } } string defaultSchema = properties[Cfg.Environment.DefaultSchema] as string; if ( defaultSchema!=null) log.Info ("Default schema set to: " + defaultSchema); bool showSql = PropertiesHelper.GetBoolean( Cfg.Environment.ShowSql, properties, false ); if (showSql) log.Info("echoing all SQL to stdout"); // queries: IDictionary querySubstitutions = PropertiesHelper.ToDictionary( Cfg.Environment.QuerySubstitutions, " ,=;:\n\t\r\f", properties ); if ( log.IsInfoEnabled ) { StringBuilder sb = new StringBuilder("Query language substitutions: "); foreach(DictionaryEntry entry in querySubstitutions) { sb.AppendFormat("{0}={1};", entry.Key, entry.Value); } log.Info(sb.ToString()); } string cacheClassName = PropertiesHelper.GetString( Environment.CacheProvider, properties, "NHibernate.Cache.HashtableCacheProvider" ); ICacheProvider cacheProvider = null; log.Info( "cache provider: " + cacheClassName ); try { cacheProvider = (ICacheProvider) Activator.CreateInstance( ReflectHelper.ClassForName( cacheClassName ) ); } catch( Exception e ) { throw new HibernateException( "could not instantiate CacheProvider: " + cacheClassName, e ); } string sessionFactoryName = (string) properties[ Cfg.Environment.SessionFactoryName ]; settings.DefaultSchemaName = defaultSchema; settings.IsShowSqlEnabled = showSql; settings.Dialect = dialect; settings.IsolationLevel = isolation; settings.ConnectionProvider = connectionProvider; settings.QuerySubstitutions = querySubstitutions; settings.TransactionFactory = transactionFactory; settings.CacheProvider = cacheProvider; settings.SessionFactoryName = sessionFactoryName; settings.IsOuterJoinFetchEnabled = useOuterJoin; return settings; } } } |
From: Michael D. <mik...@us...> - 2004-10-29 05:58:21
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17342/NHibernate/Engine Modified Files: ISessionFactoryImplementor.cs Log Message: NH-90 : code for a pluggable cache. Added a Settings class and removed some old hibernate properties that don't apply to .net. Index: ISessionFactoryImplementor.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Engine/ISessionFactoryImplementor.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ISessionFactoryImplementor.cs 13 Sep 2004 04:47:45 -0000 1.9 --- ISessionFactoryImplementor.cs 29 Oct 2004 05:58:06 -0000 1.10 *************** *** 63,70 **** bool EnableJoinedFetch { get; } ! /// <summary> ! /// Are scrollable <c>ResultSet</c>s supported ! /// </summary> ! bool UseScrollableResultSets { get; } //TODO: Depricate, as there is no such thing /// <summary> --- 63,70 ---- bool EnableJoinedFetch { get; } ! // /// <summary> ! // /// Are scrollable <c>ResultSet</c>s supported ! // /// </summary> ! // bool UseScrollableResultSets { get; } //TODO: Depricate, as there is no such thing /// <summary> *************** *** 118,131 **** string GetImportedClassName(string name); ! /// <summary> ! /// The ADO.NET batch size ! /// </summary> ! int ADOBatchSize { get; } //TODO: Depricate, should always be 0 ! /// <summary> ! /// Set the fetch size ! /// </summary> ! /// <param name="command"></param> ! void SetFetchSize(IDbCommand command); } } --- 118,131 ---- string GetImportedClassName(string name); ! // /// <summary> ! // /// The ADO.NET batch size ! // /// </summary> ! // int ADOBatchSize { get; } //TODO: Depricate, should always be 0 ! // /// <summary> ! // /// Set the fetch size ! // /// </summary> ! // /// <param name="command"></param> ! // void SetFetchSize(IDbCommand command); } } |
From: Michael D. <mik...@us...> - 2004-10-29 05:58:19
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17342/NHibernate/Impl Modified Files: SessionFactoryImpl.cs Log Message: NH-90 : code for a pluggable cache. Added a Settings class and removed some old hibernate properties that don't apply to .net. Index: SessionFactoryImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionFactoryImpl.cs,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** SessionFactoryImpl.cs 26 Oct 2004 21:22:18 -0000 1.33 --- SessionFactoryImpl.cs 29 Oct 2004 05:58:06 -0000 1.34 *************** *** 64,67 **** --- 64,68 ---- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(SessionFactoryImpl)); + [NonSerialized] private Settings settings; private string name; private string uuid; *************** *** 72,199 **** [NonSerialized] private IDictionary namedQueries; [NonSerialized] private IDictionary imports; - [NonSerialized] private IConnectionProvider connectionProvider; [NonSerialized] private IDictionary properties; - [NonSerialized] private bool showSql; - [NonSerialized] private bool useOuterJoin; - [NonSerialized] private IsolationLevel isolation; // TODO: figure out why this is commented out in nh and not h2.0.3 //[NonSerialized] private Templates templates; - [NonSerialized] private IDictionary querySubstitutions; - [NonSerialized] private Dialect.Dialect dialect; - [NonSerialized] private ITransactionFactory transactionFactory; - [NonSerialized] private int adoBatchSize; - [NonSerialized] private bool useScrollableResultSets; - - [NonSerialized] private string defaultSchema; - [NonSerialized] private object statementFetchSize; [NonSerialized] private IInterceptor interceptor; private static IIdentifierGenerator uuidgen = new UUIDHexGenerator(); ! public SessionFactoryImpl(Configuration cfg, IDictionary properties, IInterceptor interceptor) { - log.Info("building session factory"); if ( log.IsDebugEnabled ) { StringBuilder sb = new StringBuilder("instantiating session factory with properties: "); ! foreach(DictionaryEntry entry in properties) sb.AppendFormat("{0}={1};", entry.Key, ((string)entry.Key).IndexOf("connection_string")>0?"***":entry.Value); log.Debug(sb.ToString()); } this.interceptor = interceptor; - - Dialect.Dialect dl = null; - - try - { - dl = HibernateDialect.GetDialect(properties); - IDictionary temp = new Hashtable(); - - foreach(DictionaryEntry de in dl.DefaultProperties) - { - temp[de.Key] = de.Value; - } - foreach(DictionaryEntry de in properties) - { - temp[de.Key] = de.Value; - } - properties = temp; - } - catch (HibernateException he) - { - log.Warn( "No dialect set - using GenericDialect: " + he.Message ); - dl = new GenericDialect(); - } - dialect = dl; - - connectionProvider = ConnectionProviderFactory.NewConnectionProvider(properties); - - statementFetchSize = PropertiesHelper.GetInt32( Cfg.Environment.StatementFetchSize, properties, -1); - if((int)statementFetchSize==-1) statementFetchSize = null; - if (statementFetchSize!=null) log.Info("ado result set fetch size: " + statementFetchSize); - - useOuterJoin = PropertiesHelper.GetBoolean(Cfg.Environment.OuterJoin, properties); - log.Info("use outer join fetching: " + useOuterJoin); - - // default the isolationLevel to Unspecified to indicate to our code that no isolation level - // has been set so just use the default of the DataProvider. - string isolationString = PropertiesHelper.GetString( Cfg.Environment.Isolation, properties, String.Empty ); - if( isolationString.Length > 0) - { - try - { - isolation = (IsolationLevel)Enum.Parse( typeof(IsolationLevel), isolationString ); - log.Info( "Using Isolation Level: " + isolation.ToString() ); - } - catch( ArgumentException ae ) - { - log.Error( "error configuring IsolationLevel " + isolationString, ae ); - throw new HibernateException( - "The isolation level of " + isolationString + " is not a valid IsolationLevel. Please " + - "use one of the Member Names from the IsolationLevel.", ae ); - } - } - else - { - isolation = IsolationLevel.Unspecified; - } - - - bool usrs = PropertiesHelper.GetBoolean(Cfg.Environment.UseScrollableResultSet, properties); - int batchSize = PropertiesHelper.GetInt32(Cfg.Environment.StatementBatchSize, properties, 0); - - try - { - IDbConnection conn = connectionProvider.GetConnection(); - try - { - //get meta data - usrs = false; // no scrollable results sets in .net -> forward only readers... - batchSize = 0; // is this - } - finally - { - connectionProvider.CloseConnection(conn); - } - } - catch (Exception e) - { - log.Warn("could not obtain connection metadata", e); - } - - useScrollableResultSets = usrs; - adoBatchSize = batchSize; - - defaultSchema = properties[Cfg.Environment.DefaultSchema] as string; - if ( defaultSchema!=null) log.Info ("Default schema set to: " + defaultSchema); - - transactionFactory = BuildTransactionFactory(properties); - - showSql = PropertiesHelper.GetBoolean(Cfg.Environment.ShowSql, properties); - if (showSql) log.Info("echoing all SQL to stdout"); - this.properties = properties; // Persisters: --- 73,99 ---- [NonSerialized] private IDictionary namedQueries; [NonSerialized] private IDictionary imports; [NonSerialized] private IDictionary properties; // TODO: figure out why this is commented out in nh and not h2.0.3 //[NonSerialized] private Templates templates; [NonSerialized] private IInterceptor interceptor; private static IIdentifierGenerator uuidgen = new UUIDHexGenerator(); ! public SessionFactoryImpl(Configuration cfg, IDictionary properties, IInterceptor interceptor, Settings settings) { log.Info("building session factory"); if ( log.IsDebugEnabled ) { StringBuilder sb = new StringBuilder("instantiating session factory with properties: "); ! foreach(DictionaryEntry entry in properties) ! { sb.AppendFormat("{0}={1};", entry.Key, ((string)entry.Key).IndexOf("connection_string")>0?"***":entry.Value); + } log.Debug(sb.ToString()); } this.interceptor = interceptor; this.properties = properties; + this.settings = settings; // Persisters: *************** *** 202,206 **** classPersistersByName = new Hashtable(); ! foreach(PersistentClass model in cfg.ClassMappings) { System.Type persisterClass = model.Persister; IClassPersister cp; --- 102,107 ---- classPersistersByName = new Hashtable(); ! foreach(PersistentClass model in cfg.ClassMappings) ! { System.Type persisterClass = model.Persister; IClassPersister cp; *************** *** 221,229 **** collectionPersisters = new Hashtable(); ! foreach( Mapping.Collection map in cfg.CollectionMappings ) { collectionPersisters[map.Role] = new CollectionPersister(map, cfg, this) ; } ! foreach(IClassPersister persister in classPersisters.Values) { persister.PostInstantiate(this); } --- 122,132 ---- collectionPersisters = new Hashtable(); ! foreach( Mapping.Collection map in cfg.CollectionMappings ) ! { collectionPersisters[map.Role] = new CollectionPersister(map, cfg, this) ; } ! foreach(IClassPersister persister in classPersisters.Values) ! { persister.PostInstantiate(this); } *************** *** 231,236 **** //TODO: Add for databinding - name = (string) properties[ Cfg.Environment.SessionFactoryName ]; try { --- 134,140 ---- //TODO: Add for databinding + // serialization info + name = settings.SessionFactoryName; try { *************** *** 243,256 **** SessionFactoryObjectFactory.AddInstance(uuid, name, this, properties); - // queries: - - querySubstitutions = PropertiesHelper.ToDictionary(Cfg.Environment.QuerySubstitutions, " ,=;:\n\t\r\f", properties); - if ( log.IsInfoEnabled ) - { - StringBuilder sb = new StringBuilder("Query language substitutions: "); - foreach(DictionaryEntry entry in querySubstitutions) - sb.AppendFormat("{0}={1};", entry.Key, entry.Value); - log.Info(sb.ToString()); - } namedQueries = cfg.NamedQueries; --- 147,150 ---- *************** *** 409,418 **** public IConnectionProvider ConnectionProvider { ! get {return this.connectionProvider;} } public IsolationLevel Isolation { ! get { return isolation; } } --- 303,312 ---- public IConnectionProvider ConnectionProvider { ! get {return settings.ConnectionProvider;} } public IsolationLevel Isolation { ! get { return settings.IsolationLevel; } } *************** *** 439,447 **** if ( q==null) { ! q = new QueryTranslator(dialect); Put(cacheKey, q); } ! q.Compile(this, query, querySubstitutions, shallow); return q; --- 333,341 ---- if ( q==null) { ! q = new QueryTranslator( Dialect ); Put(cacheKey, q); } ! q.Compile(this, query, settings.QuerySubstitutions, shallow); return q; *************** *** 455,463 **** if ( q==null ) { ! q = new FilterTranslator(dialect); Put(cacheKey, q); } ! q.Compile(collectionRole, this, query, querySubstitutions, scalar); return q; --- 349,357 ---- if ( q==null ) { ! q = new FilterTranslator( Dialect ); Put(cacheKey, q); } ! q.Compile(collectionRole, this, query, settings.QuerySubstitutions, scalar); return q; *************** *** 495,499 **** try { ! return connectionProvider.GetConnection(); } catch (Exception sqle) --- 389,393 ---- try { ! return ConnectionProvider.GetConnection(); } catch (Exception sqle) *************** *** 507,511 **** try { ! connectionProvider.CloseConnection(conn); } catch (Exception e) --- 401,405 ---- try { ! ConnectionProvider.CloseConnection(conn); } catch (Exception e) *************** *** 552,556 **** public Dialect.Dialect Dialect { ! get { return dialect; } } --- 446,450 ---- public Dialect.Dialect Dialect { ! get { return settings.Dialect; } } *************** *** 562,583 **** public ITransactionFactory TransactionFactory { ! get { return transactionFactory; } } ! public bool UseAdoBatch { ! get { return adoBatchSize > 0; } ! } ! public int ADOBatchSize { ! get { return adoBatchSize; } ! } ! public bool EnableJoinedFetch { ! get { return useOuterJoin; } } ! public bool UseScrollableResultSets { ! get { return useScrollableResultSets; } ! } public string GetNamedQuery(string name) --- 456,479 ---- public ITransactionFactory TransactionFactory { ! get { return settings.TransactionFactory; } } ! // public bool UseAdoBatch ! // { ! // get { return adoBatchSize > 0; } ! // } ! // public int ADOBatchSize { ! // get { return adoBatchSize; } ! // } ! public bool EnableJoinedFetch ! { ! get { return settings.IsOuterJoinFetchEnabled; } } ! // public bool UseScrollableResultSets { ! // get { return useScrollableResultSets; } ! // } public string GetNamedQuery(string name) *************** *** 646,659 **** public string DefaultSchema { ! get { return defaultSchema; } } ! public void SetFetchSize(IDbCommand statement) ! { ! if ( statementFetchSize!=null) ! { ! // nothing to do in ADO.NET ! } ! } public IClassMetadata GetClassMetadata(System.Type persistentClass) --- 542,555 ---- public string DefaultSchema { ! get { return settings.DefaultSchemaName; } } ! // public void SetFetchSize(IDbCommand statement) ! // { ! // if ( settings.sstatementFetchSize!=null) ! // { ! // // nothing to do in ADO.NET ! // } ! // } public IClassMetadata GetClassMetadata(System.Type persistentClass) *************** *** 733,737 **** try { ! connectionProvider.Close(); } finally --- 629,633 ---- try { ! ConnectionProvider.Close(); } finally |
From: Michael D. <mik...@us...> - 2004-10-29 05:55:38
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16772/NHibernate/Cache Modified Files: HashtableCache.cs ICache.cs NonstrictReadWriteCache.cs ReadOnlyCache.cs ReadWriteCache.cs Added Files: CacheFactory.cs Log Message: NH-90 : code for a pluggable cache. Index: NonstrictReadWriteCache.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/NonstrictReadWriteCache.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** NonstrictReadWriteCache.cs 26 Oct 2004 21:15:09 -0000 1.2 --- NonstrictReadWriteCache.cs 29 Oct 2004 05:55:26 -0000 1.3 *************** *** 13,19 **** private ICache _cache; ! public NonstrictReadWriteCache(ICache cache) { - _cache = cache; } --- 13,18 ---- private ICache _cache; ! public NonstrictReadWriteCache() { } Index: ReadWriteCache.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/ReadWriteCache.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ReadWriteCache.cs 26 Oct 2004 21:15:09 -0000 1.4 --- ReadWriteCache.cs 29 Oct 2004 05:55:26 -0000 1.5 *************** *** 17,23 **** private ICache _cache; ! public ReadWriteCache(ICache cache) { - _cache = cache; } --- 17,22 ---- private ICache _cache; ! public ReadWriteCache() { } Index: HashtableCache.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/HashtableCache.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** HashtableCache.cs 26 Oct 2004 21:15:07 -0000 1.3 --- HashtableCache.cs 29 Oct 2004 05:55:26 -0000 1.4 *************** *** 3,8 **** using System.Runtime.CompilerServices; ! namespace NHibernate.Cache { ! /// <summary> /// A simple <c>Hashtable</c> based cache --- 3,8 ---- using System.Runtime.CompilerServices; ! namespace NHibernate.Cache ! { /// <summary> /// A simple <c>Hashtable</c> based cache *************** *** 54,71 **** } - // were added in h2.1 - // public void Lock( object key ) - // { - // } - // - // public void Unlock( object key ) - // { - // } - // - // public long NextTimestamp() - // { - // return Timestamper.Next(); - // } - #endregion } --- 54,57 ---- Index: ReadOnlyCache.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/ReadOnlyCache.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ReadOnlyCache.cs 26 Oct 2004 21:15:09 -0000 1.5 --- ReadOnlyCache.cs 29 Oct 2004 05:55:26 -0000 1.6 *************** *** 14,20 **** private ICache _cache; ! public ReadOnlyCache(ICache cache) { - _cache = cache; } --- 14,19 ---- private ICache _cache; ! public ReadOnlyCache() { } Index: ICache.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/ICache.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ICache.cs 26 Oct 2004 21:15:09 -0000 1.4 --- ICache.cs 29 Oct 2004 05:55:26 -0000 1.5 *************** *** 51,61 **** string Region {set;} - // were added in h2.1 - // void Lock( object key ); - // - // void Unlock( object key ); - // - // long NextTimestamp(); - } --- 51,54 ---- --- NEW FILE: CacheFactory.cs --- using System; using System.Xml; namespace NHibernate.Cache { /// <summary> /// Summary description for CacheFactory. /// </summary> public class CacheFactory { private static readonly log4net.ILog log = log4net.LogManager.GetLogger( typeof(CacheFactory) ); private CacheFactory() { // not publically creatable } public const string ReadOnly = "read-only"; public const string ReadWrite = "read-write"; public const string NonstrictReadWrite = "nonstrict-read-write"; public const string Transactional = "transactional"; public static ICacheConcurrencyStrategy CreateCache(XmlNode node, string name, bool mutable) { return CacheFactory.CreateCache( node.Attributes["usage"].Value, name, mutable ); } // was private in h2.1 public static ICacheConcurrencyStrategy CreateCache(string usage, string name, bool mutable) { if( log.IsDebugEnabled ) { log.Debug( "cache for: " + name + "usage strategy: " + usage ); } ICacheConcurrencyStrategy ccs = null; switch( usage ) { case CacheFactory.ReadOnly : if( mutable ) { log.Warn( "read-only cache configured for mutable: " + name ); } ccs = new ReadOnlyCache(); break; case CacheFactory.ReadWrite : ccs = new ReadWriteCache(); break; case CacheFactory.NonstrictReadWrite : ccs = new NonstrictReadWriteCache(); break; case CacheFactory.Transactional : // TODO: build this //ccs = new TransactionalCache(); break; default : throw new MappingException( "cache usage attribute should be read-write, read-only, nonstrict-read-write, or transactional" ); } return ccs; } } } |
From: Michael D. <mik...@us...> - 2004-10-29 05:55:35
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/CacheTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16772/NHibernate.Test/CacheTest Modified Files: CacheFixture.cs Log Message: NH-90 : code for a pluggable cache. Index: CacheFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/CacheTest/CacheFixture.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CacheFixture.cs 20 Sep 2004 17:45:59 -0000 1.2 --- CacheFixture.cs 29 Oct 2004 05:55:25 -0000 1.3 *************** *** 1,3 **** --- 1,4 ---- using System; + using System.Collections; using NHibernate.Cache; *************** *** 7,18 **** [TestFixture] ! public class CacheFixture { ! [Test] ! public void TestSimpleCache() { ! DoTestCache( new HashtableCache("theregion") ); } ! public void DoTestCache(ICache cache) { long longBefore = Timestamper.Next(); --- 8,23 ---- [TestFixture] ! public class CacheFixture ! { [Test] ! public void TestSimpleCache() ! { ! DoTestCache( new HashtableCacheProvider() ); } ! public void DoTestCache(ICacheProvider cacheProvider) ! { ! ICache cache = cacheProvider.BuildCache( typeof(String).FullName, new Hashtable() ); ! long longBefore = Timestamper.Next(); *************** *** 23,27 **** System.Threading.Thread.Sleep(15); ! ICacheConcurrencyStrategy ccs = new ReadWriteCache(cache); // cache something --- 28,33 ---- System.Threading.Thread.Sleep(15); ! ICacheConcurrencyStrategy ccs = new ReadWriteCache(); ! ccs.Cache = cache; // cache something |
From: Michael D. <mik...@us...> - 2004-10-29 05:54:51
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16603/NHibernate/Util Modified Files: PropertiesHelper.cs Log Message: Added a default value overload of GetBoolean Index: PropertiesHelper.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Util/PropertiesHelper.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** PropertiesHelper.cs 12 Jul 2004 01:31:09 -0000 1.6 --- PropertiesHelper.cs 29 Oct 2004 05:54:34 -0000 1.7 *************** *** 4,11 **** using System.Collections.Specialized; ! namespace NHibernate.Util { ! //Much of this code is taken from Maverick.NET ! public class PropertiesHelper { public static bool GetBoolean(string property, IDictionary properties) { --- 4,18 ---- using System.Collections.Specialized; ! namespace NHibernate.Util ! { //Much of this code is taken from Maverick.NET ! public class PropertiesHelper ! { ! public static bool GetBoolean(string property, IDictionary properties, bool defaultValue) ! { ! return properties[ property ]==null ? ! defaultValue : ! bool.Parse( properties[property] as string ); ! } public static bool GetBoolean(string property, IDictionary properties) { |
From: Michael D. <mik...@us...> - 2004-10-29 05:54:00
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16427/NHibernate/Loader Modified Files: Loader.cs Log Message: Removed scrollableresults and fetchsize - no meaning in .net Index: Loader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/Loader.cs,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Loader.cs 14 Oct 2004 04:33:14 -0000 1.36 --- Loader.cs 29 Oct 2004 05:53:49 -0000 1.37 *************** *** 510,533 **** /// <param name="selection"></param> /// <param name="session"></param> ! protected void Advance(IDataReader rs, RowSelection selection, ISessionImplementor session) { int firstRow = Loader.GetFirstRow(selection); ! if(firstRow!=0) { ! if(session.Factory.UseScrollableResultSets ) ! { ! //TODO: H2.0.3 synch, but I'm not sure if needed because of diff ! // between JDBC's ResultSet & ADO.NET's DataReader ! //rs.absolute(firstRow); ! for(int i = 0; i < firstRow; i++) ! { ! rs.Read(); ! } ! } ! else { ! for(int i = 0; i < firstRow; i++) ! { ! rs.Read(); ! } } } --- 510,522 ---- /// <param name="selection"></param> /// <param name="session"></param> ! protected void Advance(IDataReader rs, RowSelection selection, ISessionImplementor session) ! { int firstRow = Loader.GetFirstRow(selection); ! ! if( firstRow!=0 ) { ! for(int i = 0; i < firstRow; i++) { ! rs.Read(); } } *************** *** 575,582 **** bool useLimit = UseLimit(selection, dialect); ! bool scrollable = session.Factory.UseScrollableResultSets && ( ! scroll || ! (!useLimit && GetFirstRow(selection)!=0) ! ); if(useLimit) sqlString = dialect.GetLimitString(sqlString); --- 564,568 ---- bool useLimit = UseLimit(selection, dialect); ! bool scrollable = scroll || (!useLimit && GetFirstRow(selection)!=0); if(useLimit) sqlString = dialect.GetLimitString(sqlString); |
From: Michael D. <mik...@us...> - 2004-10-29 05:54:00
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16427/NHibernate/Impl Modified Files: BatcherImpl.cs Log Message: Removed scrollableresults and fetchsize - no meaning in .net Index: BatcherImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/BatcherImpl.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** BatcherImpl.cs 14 Oct 2004 04:33:14 -0000 1.10 --- BatcherImpl.cs 29 Oct 2004 05:53:49 -0000 1.11 *************** *** 140,145 **** IDbCommand command = Generate( sql ); // session.Preparer.BuildCommand(sql); - // not sure if this is needed because fetch size doesn't apply - factory.SetFetchSize(command); commandsToClose.Add(command); --- 140,143 ---- |
From: Michael D. <mik...@us...> - 2004-10-29 05:52:53
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16204/NHibernate/Dialect Modified Files: MsSql2000Dialect.cs MySQLDialect.cs Oracle9Dialect.cs PostgreSQLDialect.cs SybaseDialect.cs Log Message: Removed StatementBatchSize from Cfg.Environment - no meaning in .net Index: PostgreSQLDialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/PostgreSQLDialect.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PostgreSQLDialect.cs 26 Sep 2004 22:12:31 -0000 1.10 --- PostgreSQLDialect.cs 29 Oct 2004 05:52:44 -0000 1.11 *************** *** 40,44 **** DefaultProperties[Cfg.Environment.OuterJoin] = "true"; - DefaultProperties[Cfg.Environment.StatementBatchSize] = NoBatch; } --- 40,43 ---- Index: Oracle9Dialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/Oracle9Dialect.cs,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Oracle9Dialect.cs 19 Sep 2004 16:54:43 -0000 1.14 --- Oracle9Dialect.cs 29 Oct 2004 05:52:44 -0000 1.15 *************** *** 25,29 **** { // DefaultProperties[Cfg.Environment.UseStreamsForBinary] = "true"; - DefaultProperties[Cfg.Environment.StatementBatchSize] = DefaultBatchSize; DefaultProperties[Cfg.Environment.OuterJoin] = "true"; --- 25,28 ---- Index: MsSql2000Dialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/MsSql2000Dialect.cs,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** MsSql2000Dialect.cs 19 Sep 2004 16:13:01 -0000 1.19 --- MsSql2000Dialect.cs 29 Oct 2004 05:52:44 -0000 1.20 *************** *** 51,55 **** DefaultProperties[Cfg.Environment.OuterJoin] = "true"; - DefaultProperties[Cfg.Environment.StatementBatchSize] = NoBatch; } --- 51,54 ---- Index: SybaseDialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/SybaseDialect.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** SybaseDialect.cs 19 Aug 2004 17:45:25 -0000 1.10 --- SybaseDialect.cs 29 Oct 2004 05:52:44 -0000 1.11 *************** *** 32,36 **** DefaultProperties[Cfg.Environment.OuterJoin] = "true"; - DefaultProperties[Cfg.Environment.StatementBatchSize] = NoBatch; } --- 32,35 ---- Index: MySQLDialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/MySQLDialect.cs,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** MySQLDialect.cs 25 Oct 2004 05:56:18 -0000 1.19 --- MySQLDialect.cs 29 Oct 2004 05:52:44 -0000 1.20 *************** *** 51,55 **** DefaultProperties[Cfg.Environment.OuterJoin] = "true"; - DefaultProperties[Cfg.Environment.StatementBatchSize] = DefaultBatchSize; } --- 51,54 ---- |
From: Michael D. <mik...@us...> - 2004-10-26 21:23:04
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4496/Impl Modified Files: SessionFactoryImpl.cs Log Message: fixed porting typo with use of cache Index: SessionFactoryImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionFactoryImpl.cs,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** SessionFactoryImpl.cs 21 Sep 2004 09:58:24 -0000 1.32 --- SessionFactoryImpl.cs 26 Oct 2004 21:22:18 -0000 1.33 *************** *** 744,748 **** { IClassPersister p = GetPersister(persistentClass); ! if(p.HasCache) p.Cache.Release(id); } --- 744,748 ---- { IClassPersister p = GetPersister(persistentClass); ! if(p.HasCache) p.Cache.Remove(id); } |
From: Michael D. <mik...@us...> - 2004-10-26 21:23:04
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4496 Modified Files: NHibernate-1.1.csproj Log Message: fixed porting typo with use of cache Index: NHibernate-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate-1.1.csproj,v retrieving revision 1.53 retrieving revision 1.54 diff -C2 -d -r1.53 -r1.54 *** NHibernate-1.1.csproj 23 Oct 2004 15:44:04 -0000 1.53 --- NHibernate-1.1.csproj 26 Oct 2004 21:22:08 -0000 1.54 *************** *** 311,314 **** --- 311,319 ---- /> <File + RelPath = "Cache\HashtableCacheProvider.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Cache\ICache.cs" SubType = "Code" |
From: Michael D. <mik...@us...> - 2004-10-26 21:15:59
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3143 Modified Files: HashtableCache.cs ICache.cs ICacheConcurrencyStrategy.cs NonstrictReadWriteCache.cs ReadOnlyCache.cs ReadWriteCache.cs Added Files: HashtableCacheProvider.cs Log Message: modifications made to make more progress towards a plugabble cache added some more logging to it. Index: NonstrictReadWriteCache.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/NonstrictReadWriteCache.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NonstrictReadWriteCache.cs 6 May 2004 20:53:59 -0000 1.1 --- NonstrictReadWriteCache.cs 26 Oct 2004 21:15:09 -0000 1.2 *************** *** 11,19 **** private static readonly long timeout = 10000; ! private readonly ICache cache; public NonstrictReadWriteCache(ICache cache) { ! this.cache = cache; } --- 11,19 ---- private static readonly long timeout = 10000; ! private ICache _cache; public NonstrictReadWriteCache(ICache cache) { ! _cache = cache; } *************** *** 22,31 **** public object Get(object key, long txTimestamp) { ! object result = cache.Get(key); if( result!=null & !(result is Int64) ) { ! if (log.IsDebugEnabled) log.Debug("Cache hit: " + key); return result; } return null; --- 22,46 ---- public object Get(object key, long txTimestamp) { ! if( log.IsDebugEnabled ) ! { ! log.Debug( "Cache lookup: " + key ); ! } ! ! object result = _cache.Get(key); if( result!=null & !(result is Int64) ) { ! if (log.IsDebugEnabled) ! { ! log.Debug( "Cache hit" ); ! } return result; } + else + { + if( log.IsDebugEnabled ) + { + log.Debug( "Cache miss" ); + } + } return null; *************** *** 34,47 **** public bool Put(object key, object value, long txTimestamp) { ! object result = cache.Get(key); ! if(result==null) { ! if (log.IsDebugEnabled) log.Debug("Caching new: " + key); } ! else if ( (result is Int64) && ( (Int64)result < txTimestamp / Timestamper.OneMs ) ) { // note that this is not guaranteed to be correct in a cluster // because system times could be inconsistent ! if(log.IsDebugEnabled) log.Debug("Caching invalidated: " + key); } else --- 49,68 ---- public bool Put(object key, object value, long txTimestamp) { ! object result = _cache.Get( key ); ! if( result==null ) { ! if( log.IsDebugEnabled ) ! { ! log.Debug("Caching new: " + key); ! } } ! else if( (result is Int64) && ( (Int64)result < txTimestamp / Timestamper.OneMs ) ) { // note that this is not guaranteed to be correct in a cluster // because system times could be inconsistent ! if( log.IsDebugEnabled ) ! { ! log.Debug( "Caching invalidated: " + key ); ! } } else *************** *** 50,54 **** } ! cache.Put(key, value); return true; } --- 71,75 ---- } ! _cache.Put( key, value ); return true; } *************** *** 57,81 **** { // in case the server crashes, we need the lock to timeout ! cache.Put( key, ( timeout + Timestamper.Next() / Timestamper.OneMs ) ); } public void Release(object key) { ! if(log.IsDebugEnabled) log.Debug("Invalidating: " + key); //remove the lock (any later transactions can recache) ! cache.Put(key, Timestamper.Next() / Timestamper.OneMs); } public void Remove(object key) { ! if(log.IsDebugEnabled) log.Debug("Removing: " + key); ! cache.Remove(key); } public void Clear() { ! if(log.IsDebugEnabled) log.Debug("Clearing"); ! cache.Clear(); } --- 78,111 ---- { // in case the server crashes, we need the lock to timeout ! _cache.Put( key, ( timeout + Timestamper.Next() / Timestamper.OneMs ) ); } public void Release(object key) { ! if( log.IsDebugEnabled ) ! { ! log.Debug( "Invalidating: " + key ); ! } //remove the lock (any later transactions can recache) ! _cache.Put( key, Timestamper.Next() / Timestamper.OneMs ); } public void Remove(object key) { ! if( log.IsDebugEnabled ) ! { ! log.Debug( "Removing: " + key ); ! } ! _cache.Remove( key ); } public void Clear() { ! if( log.IsDebugEnabled ) ! { ! log.Debug( "Clearing" ); ! } ! _cache.Clear(); } *************** *** 84,95 **** try { ! cache.Destroy(); } catch(Exception e) { ! log.Warn("Could not destroy cache", e); } } #endregion } --- 114,131 ---- try { ! _cache.Destroy(); } catch(Exception e) { ! log.Warn( "Could not destroy cache", e ); } } + public ICache Cache + { + get { return _cache; } + set { _cache = value; } + } + #endregion } Index: ICacheConcurrencyStrategy.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/ICacheConcurrencyStrategy.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ICacheConcurrencyStrategy.cs 6 May 2004 20:53:59 -0000 1.2 --- ICacheConcurrencyStrategy.cs 26 Oct 2004 21:15:09 -0000 1.3 *************** *** 71,74 **** --- 71,80 ---- /// <exception cref="CacheException"></exception> void Destroy(); + + /// <summary> + /// Gets or sets the <see cref="ICache"/> for this strategy to use. + /// </summary> + /// <value>The <see cref="ICache"/> for this strategy to use.</value> + ICache Cache { get; set ;} } } Index: ReadWriteCache.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/ReadWriteCache.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ReadWriteCache.cs 6 May 2004 20:53:59 -0000 1.3 --- ReadWriteCache.cs 26 Oct 2004 21:15:09 -0000 1.4 *************** *** 2,7 **** using System.Runtime.CompilerServices; ! namespace NHibernate.Cache { ! /// <summary> /// Caches data that is sometimes updated while maintaining "read committed" --- 2,7 ---- using System.Runtime.CompilerServices; ! namespace NHibernate.Cache ! { /// <summary> /// Caches data that is sometimes updated while maintaining "read committed" *************** *** 13,45 **** public class ReadWriteCache : ICacheConcurrencyStrategy { ! private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(ReadWriteCache)); ! private readonly ICache cache; public ReadWriteCache(ICache cache) { ! this.cache = cache; } #region ICacheConcurrencyStrategy Members - [MethodImpl(MethodImplOptions.Synchronized)] public object Get(object key, long txTimestamp) { ! if (log.IsDebugEnabled) log.Debug("Cache lookup: " + key); ! ! CachedItem item = cache.Get(key) as CachedItem; ! if ( ! item!=null && ! item.FreshTimestamp < txTimestamp && ! item.IsFresh // || txTimestamp < item.LockTimestamp ! ) ! { ! if (log.IsDebugEnabled) log.Debug("Cache hit: " + key); ! return item.Value; ! } ! else { ! if (log.IsDebugEnabled) log.Debug("Cache miss: " + key); ! return null; } } --- 13,57 ---- public class ReadWriteCache : ICacheConcurrencyStrategy { ! private static readonly log4net.ILog log = log4net.LogManager.GetLogger( typeof(ReadWriteCache) ); ! private readonly object lockObject = new object(); ! private ICache _cache; public ReadWriteCache(ICache cache) { ! _cache = cache; } #region ICacheConcurrencyStrategy Members public object Get(object key, long txTimestamp) { ! lock( lockObject ) { ! if( log.IsDebugEnabled ) ! { ! log.Debug("Cache lookup: " + key); ! } ! ! CachedItem item = _cache.Get(key) as CachedItem; ! if ( ! item!=null && ! item.FreshTimestamp < txTimestamp && ! item.IsFresh // || txTimestamp < item.LockTimestamp ! ) ! { ! if( log.IsDebugEnabled ) ! { ! log.Debug( "Cache hit: " + key ); ! } ! return item.Value; ! } ! else ! { ! if( log.IsDebugEnabled ) ! { ! log.Debug( "Cache miss: " + key ); ! } ! return null; ! } } } *************** *** 48,98 **** // in this class until unlocked - [MethodImpl(MethodImplOptions.Synchronized)] public void Lock(object key) { ! if (log.IsDebugEnabled) log.Debug("Invalidating: " + key); ! CachedItem item = cache.Get(key) as CachedItem; ! if ( item==null) item = new CachedItem(null); ! item.Lock(); ! cache.Put(key, item); } - [MethodImpl(MethodImplOptions.Synchronized)] public bool Put(object key, object value, long txTimestamp) { ! if (log.IsDebugEnabled) log.Debug("Caching: " + key); ! ! CachedItem item = cache.Get(key) as CachedItem; ! if ( ! item==null || ! (item.IsUnlocked && !item.IsFresh && item.UnlockTimestamp < txTimestamp) ! ) ! { ! cache.Put(key, new CachedItem(value) ); ! if (log.IsDebugEnabled) log.Debug("Cached: " + key); ! return true; ! } ! else { ! if (log.IsDebugEnabled) log.Debug("Could not cache: " + key); ! return false; } } - [MethodImpl(MethodImplOptions.Synchronized)] public void Release(object key) { ! if (log.IsDebugEnabled) log.Debug("Releasing: " + key); ! ! CachedItem item = cache.Get(key) as CachedItem; ! if (item != null) ! { ! item.Unlock(); ! cache.Put(key, item); ! } ! else { ! log.Warn("An item was expired by the cache while it was locked"); } } --- 60,130 ---- // in this class until unlocked public void Lock(object key) { ! lock( lockObject ) ! { ! if( log.IsDebugEnabled ) ! { ! log.Debug("Invalidating: " + key); ! } ! CachedItem item = _cache.Get( key ) as CachedItem; ! if ( item==null ) item = new CachedItem( null ); ! item.Lock(); ! _cache.Put( key, item ); ! } } public bool Put(object key, object value, long txTimestamp) { ! lock( lockObject ) { ! if( log.IsDebugEnabled ) ! { ! log.Debug( "Caching: " + key ); ! } ! ! CachedItem item = _cache.Get( key ) as CachedItem; ! if ( ! item==null || ! (item.IsUnlocked && !item.IsFresh && item.UnlockTimestamp < txTimestamp) ! ) ! { ! _cache.Put( key, new CachedItem( value ) ); ! if( log.IsDebugEnabled ) ! { ! log.Debug( "Cached: " + key ); ! } ! return true; ! } ! else ! { ! if( log.IsDebugEnabled ) ! { ! log.Debug( "Could not cache: " + key ); ! } ! return false; ! } } } public void Release(object key) { ! lock( lockObject ) { ! if( log.IsDebugEnabled ) ! { ! log.Debug( "Releasing: " + key ); ! } ! CachedItem item = _cache.Get( key ) as CachedItem; ! if( item!=null ) ! { ! item.Unlock(); ! _cache.Put( key, item ); ! } ! else ! { ! log.Warn( "An item was expired by the cache while it was locked" ); ! } } } *************** *** 100,109 **** public void Clear() { ! cache.Clear(); } public void Remove(object key) { ! cache.Remove(key); } --- 132,141 ---- public void Clear() { ! _cache.Clear(); } public void Remove(object key) { ! _cache.Remove( key ); } *************** *** 112,123 **** try { ! cache.Destroy(); } catch(Exception e) { ! log.Warn("Could not destroy cache", e); } } #endregion --- 144,161 ---- try { ! _cache.Destroy(); } catch(Exception e) { ! log.Warn( "Could not destroy cache", e ); } } + public ICache Cache + { + get { return _cache; } + set { _cache = value; } + } + #endregion Index: HashtableCache.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/HashtableCache.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HashtableCache.cs 20 Aug 2004 02:34:20 -0000 1.2 --- HashtableCache.cs 26 Oct 2004 21:15:07 -0000 1.3 *************** *** 54,69 **** } ! public void Lock( object key ) ! { ! } ! ! public void Unlock( object key ) ! { ! } ! ! public long NextTimestamp() ! { ! return Timestamper.Next(); ! } #endregion --- 54,70 ---- } ! // were added in h2.1 ! // public void Lock( object key ) ! // { ! // } ! // ! // public void Unlock( object key ) ! // { ! // } ! // ! // public long NextTimestamp() ! // { ! // return Timestamper.Next(); ! // } #endregion Index: ReadOnlyCache.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/ReadOnlyCache.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ReadOnlyCache.cs 6 May 2004 20:53:59 -0000 1.4 --- ReadOnlyCache.cs 26 Oct 2004 21:15:09 -0000 1.5 *************** *** 10,29 **** { private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(ReadOnlyCache)); ! private readonly ICache cache; ! public ReadOnlyCache(ICache cache) { ! this.cache = cache; } #region ICacheConcurrencyStrategy Members - [MethodImpl(MethodImplOptions.Synchronized)] public object Get(object key, long timestamp) { ! object result = cache.Get(key); ! if ( result!=null && log.IsDebugEnabled) log.Debug("Cache hit: " + key); ! return result; } --- 10,44 ---- { private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(ReadOnlyCache)); ! ! private object lockObject = new object(); ! private ICache _cache; public ReadOnlyCache(ICache cache) { ! _cache = cache; } #region ICacheConcurrencyStrategy Members public object Get(object key, long timestamp) { ! lock( lockObject ) ! { ! if( log.IsDebugEnabled ) ! { ! log.Debug( "Cache lookup: " + key ); ! } ! ! object result = _cache.Get( key ); ! if ( result!=null && log.IsDebugEnabled ) ! { ! log.Debug( "Cache hit" ); ! } ! else if( log.IsDebugEnabled ) ! { ! log.Debug( "Cache miss" ); ! } ! return result; ! } } *************** *** 34,42 **** } - [MethodImpl(MethodImplOptions.Synchronized)] public bool Put(object key, object value, long timestamp) { ! if (log.IsDebugEnabled) log.Debug("Caching: " + key); ! cache.Put(key, value); ! return true; } --- 49,63 ---- } public bool Put(object key, object value, long timestamp) { ! ! lock( lockObject ) ! { ! if (log.IsDebugEnabled) ! { ! log.Debug("Caching: " + key); ! } ! _cache.Put(key, value); ! return true; ! } } *************** *** 49,58 **** public void Clear() { ! cache.Clear(); } public void Remove(object key) { ! cache.Remove(key); } --- 70,79 ---- public void Clear() { ! _cache.Clear(); } public void Remove(object key) { ! _cache.Remove(key); } *************** *** 61,65 **** try { ! cache.Destroy(); } catch(Exception e) --- 82,86 ---- try { ! _cache.Destroy(); } catch(Exception e) *************** *** 68,71 **** --- 89,98 ---- } } + + public ICache Cache + { + get { return _cache; } + set { _cache = value; } + } #endregion Index: ICache.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/ICache.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ICache.cs 20 Aug 2004 02:34:20 -0000 1.3 --- ICache.cs 26 Oct 2004 21:15:09 -0000 1.4 *************** *** 50,59 **** /// <exception cref="CacheException"></exception> string Region {set;} ! ! void Lock( object key ); ! ! void Unlock( object key ); ! ! long NextTimestamp(); } --- 50,60 ---- /// <exception cref="CacheException"></exception> string Region {set;} ! ! // were added in h2.1 ! // void Lock( object key ); ! // ! // void Unlock( object key ); ! // ! // long NextTimestamp(); } --- NEW FILE: HashtableCacheProvider.cs --- using System; using System.Collections; namespace NHibernate.Cache { /// <summary> /// Cache Provider plugin for NHibernate that is configured by using /// <c>hibernate.cache.provider_class="NHibernate.Cache.HashtableCacheProvider"</c> /// </summary> public class HashtableCacheProvider : ICacheProvider { #region ICacheProvider Members public ICache BuildCache(string regionName, ICollection properties) { return new HashtableCache( regionName ); } public long NextTimestamp() { return Timestamper.Next(); } #endregion } } |
From: Michael D. <mik...@us...> - 2004-10-26 18:21:30
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/NHSpecific In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28592/NHibernate.DomainModel/NHSpecific Modified Files: ClassWithCompositeId.cs ClassWithCompositeId.hbm.xml CompositeId.cs Log Message: modified to verify that access attribute does work correctly with composite-id Index: CompositeId.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/NHSpecific/CompositeId.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CompositeId.cs 9 Jun 2004 01:04:35 -0000 1.1 --- CompositeId.cs 26 Oct 2004 18:21:18 -0000 1.2 *************** *** 27,38 **** } ! public short KeyShort { ! get { return _keyShort;} ! set {_keyShort = value;} ! } public System.DateTime KeyDateTime { get { return _keyDateTime;} ! set {_keyDateTime = value;} } --- 27,38 ---- } ! // public short KeyShort { ! // get { return _keyShort;} ! // set {_keyShort = value;} ! // } public System.DateTime KeyDateTime { get { return _keyDateTime;} ! // set {_keyDateTime = value;} } Index: ClassWithCompositeId.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/NHSpecific/ClassWithCompositeId.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ClassWithCompositeId.cs 9 Jun 2004 01:04:35 -0000 1.1 --- ClassWithCompositeId.cs 26 Oct 2004 18:21:18 -0000 1.2 *************** *** 12,19 **** public ClassWithCompositeId(){} public CompositeId Id { get {return _id;} ! set {_id = value;} } --- 12,24 ---- public ClassWithCompositeId(){} + + public ClassWithCompositeId(CompositeId id ) + { + _id = id; + } public CompositeId Id { get {return _id;} ! //set {_id = value;} } Index: ClassWithCompositeId.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/NHSpecific/ClassWithCompositeId.hbm.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ClassWithCompositeId.hbm.xml 19 Jul 2004 03:19:01 -0000 1.2 --- ClassWithCompositeId.hbm.xml 26 Oct 2004 18:21:18 -0000 1.3 *************** *** 7,14 **** table="class_w_com_id" > ! <composite-id name="Id" class="NHibernate.DomainModel.NHSpecific.CompositeId, NHibernate.DomainModel"> ! <key-property name="KeyString" column="string_" type="String(20)" length="20"/> ! <key-property name="KeyShort" column="short_"/> ! <key-property name="KeyDateTime" column="date_" type="DateTime"/> </composite-id> --- 7,14 ---- table="class_w_com_id" > ! <composite-id name="Id" class="NHibernate.DomainModel.NHSpecific.CompositeId, NHibernate.DomainModel" access="nosetter.camelcase-underscore"> ! <key-property name="KeyString" column="string_" type="String(20)" length="20" /> ! <key-property name="KeyShort" column="short_" access="field.camelcase-underscore"/> ! <key-property name="KeyDateTime" column="date_" type="DateTime" access="nosetter.camelcase-underscore"/> </composite-id> |
From: Michael D. <mik...@us...> - 2004-10-26 18:21:29
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28592/NHibernate.Test/NHSpecificTest Modified Files: ClassWithCompositeIdFixture.cs Log Message: modified to verify that access attribute does work correctly with composite-id Index: ClassWithCompositeIdFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHSpecificTest/ClassWithCompositeIdFixture.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ClassWithCompositeIdFixture.cs 20 Sep 2004 17:46:00 -0000 1.5 --- ClassWithCompositeIdFixture.cs 26 Oct 2004 18:21:18 -0000 1.6 *************** *** 62,71 **** ITransaction t = s.BeginTransaction(); ! ClassWithCompositeId theClass = new ClassWithCompositeId(); ! theClass.Id = id; theClass.OneProperty = 5; ! ClassWithCompositeId theSecondClass = new ClassWithCompositeId(); ! theSecondClass.Id = secondId; theSecondClass.OneProperty = 10; --- 62,71 ---- ITransaction t = s.BeginTransaction(); ! ClassWithCompositeId theClass = new ClassWithCompositeId(id); ! //theClass.Id = id; theClass.OneProperty = 5; ! ClassWithCompositeId theSecondClass = new ClassWithCompositeId(secondId); ! //theSecondClass.Id = secondId; theSecondClass.OneProperty = 10; *************** *** 155,160 **** { CompositeId id = new CompositeId("stringKey", 3, firstDateTime); ! ClassWithCompositeId cId = new ClassWithCompositeId(); ! cId.Id = id; cId.OneProperty = 5; --- 155,160 ---- { CompositeId id = new CompositeId("stringKey", 3, firstDateTime); ! ClassWithCompositeId cId = new ClassWithCompositeId(id); ! //cId.Id = id; cId.OneProperty = 5; *************** *** 185,194 **** ITransaction t = s.BeginTransaction(); ! ClassWithCompositeId theClass = new ClassWithCompositeId(); ! theClass.Id = id; theClass.OneProperty = 5; ! ClassWithCompositeId theSecondClass = new ClassWithCompositeId(); ! theSecondClass.Id = secondId; theSecondClass.OneProperty = 10; --- 185,194 ---- ITransaction t = s.BeginTransaction(); ! ClassWithCompositeId theClass = new ClassWithCompositeId(id); ! //theClass.Id = id; theClass.OneProperty = 5; ! ClassWithCompositeId theSecondClass = new ClassWithCompositeId(secondId); ! //theSecondClass.Id = secondId; theSecondClass.OneProperty = 10; |
From: Michael D. <mik...@us...> - 2004-10-25 06:48:14
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/MappingTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22787/NHibernate.Test/MappingTest Added Files: TableFixture.cs Log Message: Added some test for Timestampper cache problems and a test to verify NH-132 is not a problem. --- NEW FILE: TableFixture.cs --- using System; using NHibernate.Mapping; using NUnit.Framework; namespace NHibernate.Test.MappingTest { /// <summary> /// Summary description for TableFixture. /// </summary> [TestFixture] public class TableFixture { [Test] public void TableNameQuoted() { Table tbl = new Table(); tbl.Name = "`keyword`"; Dialect.Dialect dialect = new Dialect.MsSql2000Dialect(); Assert.AreEqual( "[keyword]", tbl.GetQuotedName( dialect ) ); Assert.AreEqual( "dbo.[keyword]", tbl.GetQualifiedName( dialect, "dbo" ) ); Assert.AreEqual( "[keyword]", tbl.GetQualifiedName( dialect, null ) ); tbl.Schema = "sch"; Assert.AreEqual( "sch.[keyword]", tbl.GetQualifiedName( dialect ) ); } [Test] public void TableNameNotQuoted() { Table tbl = new Table(); tbl.Name = "notkeyword"; Dialect.Dialect dialect = new Dialect.MsSql2000Dialect(); Assert.AreEqual( "notkeyword", tbl.GetQuotedName( dialect ) ); Assert.AreEqual( "dbo.notkeyword", tbl.GetQualifiedName( dialect, "dbo" ) ); Assert.AreEqual( "notkeyword", tbl.GetQualifiedName( dialect, null ) ); tbl.Schema = "sch"; Assert.AreEqual( "sch.notkeyword", tbl.GetQualifiedName( dialect ) ); } } } |
From: Michael D. <mik...@us...> - 2004-10-25 06:48:14
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22787/NHibernate.Test Modified Files: NHibernate.Test-1.1.csproj Log Message: Added some test for Timestampper cache problems and a test to verify NH-132 is not a problem. Index: NHibernate.Test-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/NHibernate.Test-1.1.csproj,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** NHibernate.Test-1.1.csproj 23 Oct 2004 15:44:07 -0000 1.47 --- NHibernate.Test-1.1.csproj 25 Oct 2004 06:48:03 -0000 1.48 *************** *** 221,224 **** --- 221,229 ---- /> <File + RelPath = "CacheTest\TimestamperFixture.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "CfgTest\ConfigurationFixture.cs" SubType = "Code" *************** *** 301,304 **** --- 306,314 ---- /> <File + RelPath = "MappingTest\TableFixture.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "NHSpecificTest\BasicBinaryFixture.cs" SubType = "Code" |
From: Michael D. <mik...@us...> - 2004-10-25 06:48:14
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/CacheTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22787/NHibernate.Test/CacheTest Added Files: TimestamperFixture.cs Log Message: Added some test for Timestampper cache problems and a test to verify NH-132 is not a problem. --- NEW FILE: TimestamperFixture.cs --- using System; using NHibernate.Cache; using NUnit.Framework; namespace NHibernate.Test.CacheTest { /// <summary> /// Summary description for TimestamperFixture. /// </summary> [TestFixture] public class TimestamperFixture { [Test] public void VerifyIncrease() { long currentTicks = 0; long newTicks = 0; // the Timestampper will only generate 4095 increasing identifiers per millisecond. for( int i=0; i<4095; i++ ) { newTicks = Timestamper.Next(); if( (newTicks - currentTicks) == 0 ) { Assert.Fail( "diff was " + (newTicks - currentTicks) + ". It should always increase. Loop i=" + i + " with currentTicks = " + currentTicks + " and newTicks = " + newTicks ); } currentTicks = newTicks; } } } } |
From: Michael D. <mik...@us...> - 2004-10-25 06:47:11
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/MappingTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22603/MappingTest Log Message: Directory /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/MappingTest added to the repository |
From: Michael D. <mik...@us...> - 2004-10-25 05:56:27
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13911 Modified Files: MySQLDialect.cs Log Message: NH-129 Index: MySQLDialect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Dialect/MySQLDialect.cs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** MySQLDialect.cs 19 Jul 2004 13:52:26 -0000 1.18 --- MySQLDialect.cs 25 Oct 2004 05:56:18 -0000 1.19 *************** *** 34,38 **** Register( DbType.Decimal, "NUMERIC(19,5)" ); Register( DbType.Decimal, 19, "NUMERIC(19, $1)"); ! Register( DbType.Double, "FLOAT" ); Register( DbType.Int16, "SMALLINT" ); Register( DbType.Int32, "INTEGER" ); --- 34,39 ---- Register( DbType.Decimal, "NUMERIC(19,5)" ); Register( DbType.Decimal, 19, "NUMERIC(19, $1)"); ! Register( DbType.Double, "FLOAT" ); ! Register( DbType.Guid, "VARCHAR(40)" ); Register( DbType.Int16, "SMALLINT" ); Register( DbType.Int32, "INTEGER" ); |
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Type In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11004/NHibernate/Type Modified Files: BinaryType.cs BooleanType.cs ByteType.cs CharBooleanType.cs CharType.cs CultureInfoType.cs DateTimeType.cs DateType.cs DecimalType.cs DoubleType.cs GuidType.cs Int16Type.cs Int32Type.cs Int64Type.cs SerializableType.cs SingleType.cs StringClobType.cs StringType.cs TicksType.cs TimeSpanType.cs TrueFalseType.cs TypeType.cs YesNoType.cs Log Message: minor updates to xml docs. Index: TypeType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TypeType.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TypeType.cs 21 Aug 2004 16:37:33 -0000 1.3 --- TypeType.cs 25 Oct 2004 05:37:56 -0000 1.4 *************** *** 9,13 **** /// <summary> /// Maps the Assembly Qualified Name of a <see cref="System.Type"/> to a ! /// variable length string column. /// </summary> public class TypeType : ImmutableType --- 9,13 ---- /// <summary> /// Maps the Assembly Qualified Name of a <see cref="System.Type"/> to a ! /// <see cref="DbType.Stirng" /> column. /// </summary> public class TypeType : ImmutableType Index: ByteType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/ByteType.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ByteType.cs 20 Sep 2004 03:00:29 -0000 1.7 --- ByteType.cs 25 Oct 2004 05:37:56 -0000 1.8 *************** *** 8,14 **** /// <summary> ! /// ByteType. /// </summary> ! public class ByteType : ValueTypeType, IDiscriminatorType { internal ByteType() : base( new ByteSqlType() ) --- 8,16 ---- /// <summary> ! /// Maps a <see cref="System.Byte"/> Property ! /// to a <see cref="DbType.Byte"/> column. /// </summary> ! public class ByteType : ValueTypeType, IDiscriminatorType ! { internal ByteType() : base( new ByteSqlType() ) Index: DateType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/DateType.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** DateType.cs 19 Oct 2004 02:24:08 -0000 1.11 --- DateType.cs 25 Oct 2004 05:37:56 -0000 1.12 *************** *** 6,9 **** --- 6,13 ---- { + /// <summary> + /// Maps the Year, Month, and Day of a <see cref="System.DateTime"/> Property to a + /// <see cref="DbType.Date"/> column + /// </summary> public class DateType : ValueTypeType, IIdentifierType, ILiteralType { Index: YesNoType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/YesNoType.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** YesNoType.cs 21 Aug 2004 16:37:33 -0000 1.5 --- YesNoType.cs 25 Oct 2004 05:37:56 -0000 1.6 *************** *** 6,11 **** { /// <summary> ! /// Maps a System.Boolean to a single character column that stores a ! /// "Y"/"N" to indicate true/false. /// </summary> /// <remarks> --- 6,11 ---- { /// <summary> ! /// Maps a <see cref="System.Boolean" /> to a 1 char <see cref="DbType.AnsiStringFixedLength" /> column ! /// that stores a <code>'Y'/'N'</code> to indicate <code>true/false</code>. /// </summary> /// <remarks> Index: Int16Type.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/Int16Type.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Int16Type.cs 19 Oct 2004 02:24:08 -0000 1.5 --- Int16Type.cs 25 Oct 2004 05:37:56 -0000 1.6 *************** *** 6,10 **** namespace NHibernate.Type { ! public class Int16Type : ValueTypeType, IDiscriminatorType, IVersionType { internal Int16Type() : base( new Int16SqlType() ) --- 6,15 ---- namespace NHibernate.Type { ! /// <summary> ! /// Maps a <see cref="System.Int16"/> Property ! /// to a <see cref="DbType.Int16"/> column. ! /// </summary> ! public class Int16Type : ValueTypeType, IDiscriminatorType, IVersionType ! { internal Int16Type() : base( new Int16SqlType() ) Index: CultureInfoType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/CultureInfoType.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** CultureInfoType.cs 21 Aug 2004 16:37:32 -0000 1.3 --- CultureInfoType.cs 25 Oct 2004 05:37:56 -0000 1.4 *************** *** 8,15 **** /// <summary> ! /// CultureInfoType for using a System.Globalization.CultureInfo an the ! /// culture name (not the Culture ID) is stored in the DB. /// </summary> ! public class CultureInfoType : ImmutableType, ILiteralType { internal CultureInfoType() : base( new StringSqlType(5) ) --- 8,20 ---- /// <summary> ! /// Maps a <see cref="System.Globalization.CultureInfo"/> Property ! /// to a <see cref="DbType.String"/> column. /// </summary> ! /// <remarks> ! /// CultureInfoType stores the culture name (not the Culture ID) of the ! /// <see cref="System.Globalization.CultureInfo"/> in the DB. ! /// </remarks> ! public class CultureInfoType : ImmutableType, ILiteralType ! { internal CultureInfoType() : base( new StringSqlType(5) ) Index: DecimalType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/DecimalType.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DecimalType.cs 20 Sep 2004 03:00:29 -0000 1.6 --- DecimalType.cs 25 Oct 2004 05:37:56 -0000 1.7 *************** *** 8,12 **** /// <summary> ! /// DecimalType /// </summary> public class DecimalType : ValueTypeType, IIdentifierType --- 8,13 ---- /// <summary> ! /// Maps a <see cref="System.Decimal"/> Property ! /// to a <see cref="DbType.Decimal"/> column. /// </summary> public class DecimalType : ValueTypeType, IIdentifierType Index: GuidType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/GuidType.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** GuidType.cs 20 Sep 2004 03:00:29 -0000 1.4 --- GuidType.cs 25 Oct 2004 05:37:56 -0000 1.5 *************** *** 6,10 **** namespace NHibernate.Type { ! public class GuidType : ValueTypeType, IDiscriminatorType { --- 6,13 ---- namespace NHibernate.Type { ! /// <summary> ! /// Maps a <see cref="System.Guid"/> Property ! /// to a <see cref="DbType.Guid"/> column. ! /// </summary> public class GuidType : ValueTypeType, IDiscriminatorType { Index: SingleType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/SingleType.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SingleType.cs 20 Sep 2004 03:00:29 -0000 1.5 --- SingleType.cs 25 Oct 2004 05:37:56 -0000 1.6 *************** *** 8,16 **** /// <summary> ! /// Maps a System.Single Property to an column that can store a single precision number. /// </summary> /// <remarks> /// Verify through your database's documentation if there is a column type that ! /// matches up with the capabilities of System.Single /// </remarks> public class SingleType : ValueTypeType --- 8,17 ---- /// <summary> ! /// Maps a <see cref="System.Single" /> Property to an ! /// <see cref="DbType.Single" /> column. /// </summary> /// <remarks> /// Verify through your database's documentation if there is a column type that ! /// matches up with the capabilities of <see cref="System.Single" /> /// </remarks> public class SingleType : ValueTypeType Index: BooleanType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/BooleanType.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** BooleanType.cs 20 Sep 2004 03:00:29 -0000 1.9 --- BooleanType.cs 25 Oct 2004 05:37:56 -0000 1.10 *************** *** 10,18 **** /// to a <see cref="DbType.Boolean"/> column. /// </summary> - /// <remarks> - /// Had to use setShort / getShort instead of setBoolean / getBoolean - /// to work around a HypersonicSQL driver bug - these are comments copied - /// from Hibernate so I am not sure how/if they apply to NHibernate - /// </remarks> public class BooleanType : ValueTypeType, IDiscriminatorType { --- 10,13 ---- Index: Int64Type.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/Int64Type.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Int64Type.cs 19 Oct 2004 02:24:08 -0000 1.5 --- Int64Type.cs 25 Oct 2004 05:37:56 -0000 1.6 *************** *** 6,9 **** --- 6,13 ---- namespace NHibernate.Type { + /// <summary> + /// Maps a <see cref="System.Int64"/> Property + /// to a <see cref="DbType.Int64"/> column. + /// </summary> public class Int64Type : ValueTypeType, IIdentifierType, IVersionType { Index: CharBooleanType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/CharBooleanType.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CharBooleanType.cs 20 Aug 2004 17:39:01 -0000 1.6 --- CharBooleanType.cs 25 Oct 2004 05:37:56 -0000 1.7 *************** *** 7,13 **** /// <summary> ! /// Alternative boolean types. /// </summary> ! public abstract class CharBooleanType : BooleanType { protected abstract string TrueString { get; } --- 7,15 ---- /// <summary> ! /// Maps a <see cref="System.Boolean"/> Property ! /// to a <see cref="DbType.AnsiStringFixedLength"/> column. /// </summary> ! public abstract class CharBooleanType : BooleanType ! { protected abstract string TrueString { get; } *************** *** 28,32 **** public override object Get(IDataReader rs, string name) { ! return Get(rs, rs.GetOrdinal(name)); } --- 30,34 ---- public override object Get(IDataReader rs, string name) { ! return Get(rs, rs.GetOrdinal(name)); } Index: CharType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/CharType.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CharType.cs 20 Sep 2004 03:00:29 -0000 1.5 --- CharType.cs 25 Oct 2004 05:37:56 -0000 1.6 *************** *** 7,13 **** /// <summary> ! /// Summary description for CharacterType. /// </summary> ! public class CharType : ValueTypeType , IDiscriminatorType { internal CharType() : base( new StringFixedLengthSqlType(1) ) --- 7,15 ---- /// <summary> ! /// Maps a <see cref="System.Char"/> Property ! /// to a <see cref="DbType.Char"/> column. /// </summary> ! public class CharType : ValueTypeType , IDiscriminatorType ! { internal CharType() : base( new StringFixedLengthSqlType(1) ) Index: SerializableType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/SerializableType.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SerializableType.cs 21 Aug 2004 16:37:33 -0000 1.5 --- SerializableType.cs 25 Oct 2004 05:37:56 -0000 1.6 *************** *** 10,20 **** /// <summary> ! /// Maps an instance of a System.Type that has the SerializableAttribute to ! /// a Binary column. /// </summary> /// <remarks> /// <para> ! /// The Serializabletype should be used when you know that Bytes are ! /// not going to be greater than 8,000 /// </para> /// <para> --- 10,20 ---- /// <summary> ! /// Maps an instance of a <see cref="System.Object" /> that has the <see cref="System.SerializableAttribute" /> ! /// to a <see cref="DbType.Binary" /> column. /// </summary> /// <remarks> /// <para> ! /// The SerializableType should be used when you know that Bytes are ! /// not going to be greater than 8,000. /// </para> /// <para> Index: Int32Type.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/Int32Type.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Int32Type.cs 19 Oct 2004 02:24:08 -0000 1.6 --- Int32Type.cs 25 Oct 2004 05:37:56 -0000 1.7 *************** *** 6,10 **** namespace NHibernate.Type { ! public class Int32Type : ValueTypeType, IDiscriminatorType, IVersionType { internal Int32Type() : base( new Int32SqlType() ) --- 6,15 ---- namespace NHibernate.Type { ! /// <summary> ! /// Maps a <see cref="System.Int32"/> Property ! /// to a <see cref="DbType.Int32"/> column. ! /// </summary> ! public class Int32Type : ValueTypeType, IDiscriminatorType, IVersionType ! { internal Int32Type() : base( new Int32SqlType() ) Index: TicksType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TicksType.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TicksType.cs 19 Oct 2004 02:24:08 -0000 1.6 --- TicksType.cs 25 Oct 2004 05:37:56 -0000 1.7 *************** *** 8,13 **** /// <summary> ! /// Maps a System.DateTime Property to an Int64 column that stores the DateTime using ! /// the Ticks property. /// </summary> /// <remarks> --- 8,13 ---- /// <summary> ! /// Maps a <see cref="System.DateTime" /> Property to an <see cref="DbType.Int64" /> column ! /// that stores the DateTime using the Ticks property. /// </summary> /// <remarks> Index: StringClobType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/StringClobType.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** StringClobType.cs 25 Aug 2004 03:52:21 -0000 1.1 --- StringClobType.cs 25 Oct 2004 05:37:56 -0000 1.2 *************** *** 6,10 **** { /// <summary> ! /// Maps a System.String Property to an column that can store a CLOB. /// </summary> /// <remarks> --- 6,11 ---- { /// <summary> ! /// Maps a <see cref="System.String" /> Property to an ! /// <see cref="System.String" /> column that can store a CLOB. /// </summary> /// <remarks> Index: BinaryType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/BinaryType.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** BinaryType.cs 21 Aug 2004 16:37:32 -0000 1.6 --- BinaryType.cs 25 Oct 2004 05:37:56 -0000 1.7 *************** *** 63,67 **** } else { ! //TODO: not sure if this will work... return (byte[])rs[index]; } --- 63,67 ---- } else { ! //TODO: not sure if this will work with all dbs return (byte[])rs[index]; } Index: DateTimeType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/DateTimeType.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** DateTimeType.cs 19 Oct 2004 02:24:08 -0000 1.11 --- DateTimeType.cs 25 Oct 2004 05:37:56 -0000 1.12 *************** *** 7,12 **** { /// <summary> ! /// Maps a System.DateTime Property to a column that stores date & time down to ! /// the accuracy of a second. /// </summary> /// <remarks> --- 7,12 ---- { /// <summary> ! /// Maps a <see cref="System.DateTime" /> Property to a <see cref="DbType.DateTime"/> column that ! /// stores date & time down to the accuracy of a second. /// </summary> /// <remarks> Index: StringType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/StringType.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** StringType.cs 21 Aug 2004 16:37:33 -0000 1.5 --- StringType.cs 25 Oct 2004 05:37:56 -0000 1.6 *************** *** 9,13 **** /// <summary> ! /// Maps a System.String to a single variable length string column /// </summary> public class StringType : ImmutableType, IDiscriminatorType { --- 9,13 ---- /// <summary> ! /// Maps a <see cref="System.String" /> to a <see cref="DbType.String" /> column. /// </summary> public class StringType : ImmutableType, IDiscriminatorType { Index: DoubleType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/DoubleType.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DoubleType.cs 20 Sep 2004 03:00:29 -0000 1.6 --- DoubleType.cs 25 Oct 2004 05:37:56 -0000 1.7 *************** *** 6,10 **** namespace NHibernate.Type { ! public class DoubleType : ValueTypeType { internal DoubleType() : base( new DoubleSqlType() ) --- 6,15 ---- namespace NHibernate.Type { ! /// <summary> ! /// Maps a <see cref="System.Double"/> Property ! /// to a <see cref="DbType.Double"/> column. ! /// </summary> ! public class DoubleType : ValueTypeType ! { internal DoubleType() : base( new DoubleSqlType() ) Index: TimeSpanType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TimeSpanType.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TimeSpanType.cs 19 Oct 2004 02:24:08 -0000 1.6 --- TimeSpanType.cs 25 Oct 2004 05:37:56 -0000 1.7 *************** *** 8,12 **** /// <summary> ! /// Maps a System.Timespan Property to an Int64 column /// </summary> public class TimeSpanType : ValueTypeType, IVersionType, ILiteralType --- 8,12 ---- /// <summary> ! /// Maps a <see cref="System.Timespan" /> Property to an <see cref="DbType.Int64" /> column /// </summary> public class TimeSpanType : ValueTypeType, IVersionType, ILiteralType Index: TrueFalseType.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Type/TrueFalseType.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TrueFalseType.cs 21 Aug 2004 16:37:33 -0000 1.4 --- TrueFalseType.cs 25 Oct 2004 05:37:56 -0000 1.5 *************** *** 6,11 **** { /// <summary> ! /// Maps a System.Boolean to a single character column that stores a ! /// "T"/F" to indicate true/false. /// </summary> /// <remarks> --- 6,11 ---- { /// <summary> ! /// Maps a <see cref="System.Boolean" /> to a 1 char <see cref="DbType.AnsiStringFixedLength" /> column ! /// that stores a <code>'T'/'F'</code> to indicate <code>true/false</code>. /// </summary> /// <remarks> |
From: Michael D. <mik...@us...> - 2004-10-25 05:20:37
|
Update of /cvsroot/nhibernate/nhibernate/doc/reference/en/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8120/modules Modified Files: architecture.xml basic_mapping.xml Log Message: worked on it a little bit more. Index: basic_mapping.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/doc/reference/en/modules/basic_mapping.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** basic_mapping.xml 22 Oct 2004 21:01:56 -0000 1.4 --- basic_mapping.xml 25 Oct 2004 05:20:25 -0000 1.5 *************** *** 1,2 **** --- 1,10 ---- + <!-- + before committing make sure to comment out the DOCTYPE + It is in here to get intellisense with XMLSpy. The + HomeEdition is a free download. + + <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "../../support/docbook-dtd/docbookx.dtd"> + --> <chapter id="mapping"> <title>Basic O/R Mapping</title> *************** *** 90,96 **** </para> ! <programlistingco> ! ! <programlisting> <hibernate-mapping schema="schemaName" <co id="hm1-co" linkends="hm1" /> --- 98,103 ---- </para> ! ! <programlisting> <hibernate-mapping schema="schemaName" <co id="hm1-co" linkends="hm1" /> *************** *** 99,133 **** default-access="property|field|nosetter|ClassName" <co id="hm4-co" linkends="hm4" /> > ! </programlisting> ! <calloutlist> ! <callout arearefs="hm1-co" id="hm1"> ! <para> ! <literal>schema</literal> (optional): The name of a database schema. ! </para> ! </callout> ! <callout arearefs="hm2-co" id="hm2"> ! <para> ! <literal>default-cascade</literal> (optional - defaults to <literal>none</literal>): ! A default cascade style. ! </para> ! </callout> ! <callout arearefs="hm3-co" id="hm3"> ! <para> ! <literal>auto-import</literal> (optional - defaults to <literal>true</literal>): ! Specifies whether we can use unqualified class names (of classes in this mapping) ! in the query language. ! </para> ! </callout> ! <callout arearefs="hm4-co" id="hm4"> ! <para> ! <literal>default-access</literal> (optional - defaults to <literal>property</literal>): ! The strategy NHibernate should use for accessing the property value. ! </para> ! </callout> ! ! </calloutlist> ! </programlistingco> <para> --- 106,139 ---- default-access="property|field|nosetter|ClassName" <co id="hm4-co" linkends="hm4" /> > ! </programlisting> ! <calloutlist> ! <callout arearefs="hm1-co" id="hm1"> ! <para> ! <literal>schema</literal> (optional): The name of a database schema. ! </para> ! </callout> ! <callout arearefs="hm2-co" id="hm2"> ! <para> ! <literal>default-cascade</literal> (optional - defaults to <literal>none</literal>): ! A default cascade style. ! </para> ! </callout> ! <callout arearefs="hm3-co" id="hm3"> ! <para> ! <literal>auto-import</literal> (optional - defaults to <literal>true</literal>): ! Specifies whether we can use unqualified class names (of classes in this mapping) ! in the query language. ! </para> ! </callout> ! <callout arearefs="hm4-co" id="hm4"> ! <para> ! <literal>default-access</literal> (optional - defaults to <literal>property</literal>): ! The strategy NHibernate should use for accessing the property value. ! </para> ! </callout> ! ! </calloutlist> <para> *************** *** 145,151 **** </para> ! <programlistingco> ! <programlisting><class name="ClassName" <co id="class1-co" linkends="class1" /> table="tableName"<co id="class2-co" linkends="class2" /> --- 151,157 ---- </para> ! ! <programlisting><class name="ClassName" <co id="class1-co" linkends="class1" /> table="tableName"<co id="class2-co" linkends="class2" /> *************** *** 160,233 **** persister="PersisterClass"<co id="class11-co" linkends="class11" /> /></programlisting> ! <calloutlist> ! <callout arearefs="class1-co" id="class1"> ! <para> ! <literal>name</literal>: The fully qualified .NET Type name of the persistent class ! (or interface). ! </para> ! </callout> ! <callout arearefs="class2-co" id="class2"> ! <para> ! <literal>table</literal>: The name of its database table. ! </para> ! </callout> ! <callout arearefs="class3-co" id="class3"> ! <para> ! <literal>discriminator-value</literal> (optional - defaults to the class name): A value ! that distiguishes individual subclasses, used for polymorphic behaviour. ! </para> ! </callout> ! <callout arearefs="class4-co" id="class4"> ! <para> ! <literal>mutable</literal> (optional, defaults to <literal>true</literal>): Specifies ! that instances of the class are (not) mutable. ! </para> ! </callout> ! <callout arearefs="class5-co" id="class5"> ! <para> ! <literal>schema</literal> (optional): Override the schema name specified by ! the root <literal><hibernate-mapping></literal> element. ! </para> ! </callout> ! <callout arearefs="class6-co" id="class6"> ! <para> ! <literal>proxy</literal> (optional): Specifies an interface to use for lazy ! initializing proxies. You may specify the name of the class itself as long as ! all Properties are virtual. ! </para> ! </callout> ! <callout arearefs="class7-co" id="class7"> ! <para> ! <literal>dynamic-update</literal> (optional, defaults to <literal>false</literal>): ! Specifies that <literal>UPDATE</literal> SQL should be generated at runtime and ! contain only those columns whose values have changed. ! </para> ! </callout> ! <callout arearefs="class8-co" id="class8"> ! <para> ! <literal>dynamic-insert</literal> (optional, defaults to <literal>false</literal>): ! Specifies that <literal>INSERT</literal> SQL should be generated at runtime and ! contain only the columns whose values are not null. ! </para> ! </callout> ! <callout arearefs="class9-co" id="class9"> ! <para> ! <literal>polymorphism</literal> (optional, defaults to <literal>implicit</literal>): ! Determines whether implicit or explicit query polymorphism is used. ! </para> ! </callout> ! <callout arearefs="class10-co" id="class10"> ! <para> ! <literal>where</literal> (optional) specify an arbitrary SQL <literal>WHERE</literal> ! condition to be used when retrieving objects of this class ! </para> ! </callout> ! <callout arearefs="class11-co" id="class11"> ! <para> ! <literal>persister</literal> (optional): Specifies a custom <literal>IClassPersister</literal>. ! </para> ! </callout> ! </calloutlist> ! </programlistingco> <para> --- 166,238 ---- persister="PersisterClass"<co id="class11-co" linkends="class11" /> /></programlisting> ! <calloutlist> ! <callout arearefs="class1-co" id="class1"> ! <para> ! <literal>name</literal>: The fully qualified .NET Type name of the persistent class ! (or interface). ! </para> ! </callout> ! <callout arearefs="class2-co" id="class2"> ! <para> ! <literal>table</literal>: The name of its database table. ! </para> ! </callout> ! <callout arearefs="class3-co" id="class3"> ! <para> ! <literal>discriminator-value</literal> (optional - defaults to the class name): A value ! that distiguishes individual subclasses, used for polymorphic behaviour. ! </para> ! </callout> ! <callout arearefs="class4-co" id="class4"> ! <para> ! <literal>mutable</literal> (optional, defaults to <literal>true</literal>): Specifies ! that instances of the class are (not) mutable. ! </para> ! </callout> ! <callout arearefs="class5-co" id="class5"> ! <para> ! <literal>schema</literal> (optional): Override the schema name specified by ! the root <literal><hibernate-mapping></literal> element. ! </para> ! </callout> ! <callout arearefs="class6-co" id="class6"> ! <para> ! <literal>proxy</literal> (optional): Specifies an interface to use for lazy ! initializing proxies. You may specify the name of the class itself as long as ! all Properties are virtual. ! </para> ! </callout> ! <callout arearefs="class7-co" id="class7"> ! <para> ! <literal>dynamic-update</literal> (optional, defaults to <literal>false</literal>): ! Specifies that <literal>UPDATE</literal> SQL should be generated at runtime and ! contain only those columns whose values have changed. ! </para> ! </callout> ! <callout arearefs="class8-co" id="class8"> ! <para> ! <literal>dynamic-insert</literal> (optional, defaults to <literal>false</literal>): ! Specifies that <literal>INSERT</literal> SQL should be generated at runtime and ! contain only the columns whose values are not null. ! </para> ! </callout> ! <callout arearefs="class9-co" id="class9"> ! <para> ! <literal>polymorphism</literal> (optional, defaults to <literal>implicit</literal>): ! Determines whether implicit or explicit query polymorphism is used. ! </para> ! </callout> ! <callout arearefs="class10-co" id="class10"> ! <para> ! <literal>where</literal> (optional) specify an arbitrary SQL <literal>WHERE</literal> ! condition to be used when retrieving objects of this class ! </para> ! </callout> ! <callout arearefs="class11-co" id="class11"> ! <para> ! <literal>persister</literal> (optional): Specifies a custom <literal>IClassPersister</literal>. ! </para> ! </callout> ! </calloutlist> <para> *************** *** 293,298 **** </para> ! <programlistingco> ! <programlisting><id name="propertyName" <co id="id1-co" linkends="id1" /> type="typename" <co id="id2-co" linkends="id2" /> --- 298,302 ---- </para> ! <programlisting><id name="propertyName" <co id="id1-co" linkends="id1" /> type="typename" <co id="id2-co" linkends="id2" /> *************** *** 303,339 **** <generator class="generatorClass"/> </id> </programlisting> ! <calloutlist> ! <callout arearefs="id1-co" id="id1"> ! <para> ! <literal>name</literal> (optional): The name of the identifier property. ! </para> ! </callout> ! <callout arearefs="id2-co" id="id2"> ! <para> ! <literal>type</literal> (optional): A name that indicates the NHibernate type. ! </para> ! </callout> ! <callout arearefs="id3-co" id="id3"> ! <para> ! <literal>column</literal> (optional - defaults to the property name): The ! name of the primary key column. ! </para> ! </callout> ! <callout arearefs="id4-co" id="id4"> ! <para> ! <literal>unsaved-value</literal> (optional - defaults to <literal>null</literal>): ! An identifier property value that indicates that an instance is newly instantiated ! (unsaved), distinguishing it from transient instances that were saved or loaded ! in a previous session. ! </para> ! </callout> ! <callout arearefs="id5-co" id="id5"> ! <para> ! <literal>access</literal> (optional - defaults to <literal>property</literal>): The ! strategy NHibernate should use for accessing the property value. ! </para> ! </callout> ! </calloutlist> ! </programlistingco> <para> --- 307,343 ---- <generator class="generatorClass"/> </id> </programlisting> ! <calloutlist> ! <callout arearefs="id1-co" id="id1"> ! <para> ! <literal>name</literal> (optional): The name of the identifier property. ! </para> ! </callout> ! <callout arearefs="id2-co" id="id2"> ! <para> ! <literal>type</literal> (optional): A name that indicates the NHibernate type. ! </para> ! </callout> ! <callout arearefs="id3-co" id="id3"> ! <para> ! <literal>column</literal> (optional - defaults to the property name): The ! name of the primary key column. ! </para> ! </callout> ! <callout arearefs="id4-co" id="id4"> ! <para> ! <literal>unsaved-value</literal> (optional - defaults to <literal>null</literal>): ! An identifier property value that indicates that an instance is newly instantiated ! (unsaved), distinguishing it from transient instances that were saved or loaded ! in a previous session. ! </para> ! </callout> ! <callout arearefs="id5-co" id="id5"> ! <para> ! <literal>access</literal> (optional - defaults to <literal>property</literal>): The ! strategy NHibernate should use for accessing the property value. ! </para> ! </callout> ! </calloutlist> ! <para> *************** *** 366,371 **** </para> ! <programlistingco> ! <programlisting><property name="propertyName"<co id="property1-co" linkends="property1" /> column="column_name"<co id="property2-co" linkends="property2" /> --- 370,374 ---- </para> ! <programlisting><property name="propertyName"<co id="property1-co" linkends="property1" /> column="column_name"<co id="property2-co" linkends="property2" /> *************** *** 376,427 **** access="field|property|nosetter|ClassName"<co id="property7-co" linkends="property7" /> /></programlisting> ! <calloutlist> ! <callout arearefs="property1-co" id="property1"> ! <para> ! <literal>name</literal>: the name of the property in the same case as the Propery in your API ! </para> ! </callout> ! <callout arearefs="property2-co" id="property2"> ! <para> ! <literal>column</literal> (optional - defaults to the property name): the name ! of the mapped database table column. ! </para> ! </callout> ! <callout arearefs="property3-co" id="property3"> ! <para> ! <literal>type</literal> (optional): a name that indicates the NHibernate type. ! </para> ! </callout> ! <callout arearefs="property4-co" id="property4"> ! <para> ! <literal>update</literal> (optional - defaults to <literal>true</literal>) : ! specifies that the mapped columns should be included in SQL <literal>UPDATE</literal> ! </para> ! </callout> ! <callout arearefs="property5-co" id="property5"> ! <para> ! <literal>insert</literal> (optional - defaults to <literal>true</literal>) : ! specifies that the mapped columns should be included in SQL ! <literal>INSERT</literal> statements. Setting both <literal>insert</literal> ! and <literal>update</literal> to <literal>false</literal> ! allows a pure "derived" property whose value is initialized from some other ! property that maps to the same colum(s) or by a trigger or other application. ! </para> ! </callout> ! <callout arearefs="property6-co" id="property6"> ! <para> ! <literal>formula</literal> (optional): an SQL expression that defines the value for a ! <emphasis>computed</emphasis> property. Computed properties do not have a column ! mapping of their own. ! </para> ! </callout> ! <callout arearefs="property7-co" id="property7"> ! <para> ! <literal>access</literal> (optional - defaults to <literal>property</literal>): The ! strategy NHibernate should use for accessing the property value. ! </para> ! </callout> ! </calloutlist> ! </programlistingco> <para> --- 379,429 ---- access="field|property|nosetter|ClassName"<co id="property7-co" linkends="property7" /> /></programlisting> ! <calloutlist> ! <callout arearefs="property1-co" id="property1"> ! <para> ! <literal>name</literal>: the name of the property in the same case as the Propery in your API ! </para> ! </callout> ! <callout arearefs="property2-co" id="property2"> ! <para> ! <literal>column</literal> (optional - defaults to the property name): the name ! of the mapped database table column. ! </para> ! </callout> ! <callout arearefs="property3-co" id="property3"> ! <para> ! <literal>type</literal> (optional): a name that indicates the NHibernate type. ! </para> ! </callout> ! <callout arearefs="property4-co" id="property4"> ! <para> ! <literal>update</literal> (optional - defaults to <literal>true</literal>) : ! specifies that the mapped columns should be included in SQL <literal>UPDATE</literal> ! </para> ! </callout> ! <callout arearefs="property5-co" id="property5"> ! <para> ! <literal>insert</literal> (optional - defaults to <literal>true</literal>) : ! specifies that the mapped columns should be included in SQL ! <literal>INSERT</literal> statements. Setting both <literal>insert</literal> ! and <literal>update</literal> to <literal>false</literal> ! allows a pure "derived" property whose value is initialized from some other ! property that maps to the same colum(s) or by a trigger or other application. ! </para> ! </callout> ! <callout arearefs="property6-co" id="property6"> ! <para> ! <literal>formula</literal> (optional): an SQL expression that defines the value for a ! <emphasis>computed</emphasis> property. Computed properties do not have a column ! mapping of their own. ! </para> ! </callout> ! <callout arearefs="property7-co" id="property7"> ! <para> ! <literal>access</literal> (optional - defaults to <literal>property</literal>): The ! strategy NHibernate should use for accessing the property value. ! </para> ! </callout> ! </calloutlist> <para> *************** *** 474,564 **** be text formatted as <literal>access-strategy.naming-strategy</literal>. The <literal>.naming-stragey</literal> is not always required. ! <variablelist> <title>Access Strategy</title> ! <varlistentry> ! <term><literal>property</literal></term> ! <listitem> ! <para> ! The default implementation. NHibernate uses the get/set of your Property. No ! Naming Strategy should be used with this Access Strategy because the ! <literal>name</literal> attribute is the name of your Property. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term><literal>field</literal></term> ! <listitem> ! <para> ! NHibernate will access the Field directly. NHibernate uses the <literal><name></literal> ! as the name of the field. This can be used when a Property's get and set have extra ! actions in them that you don't want to occur when NHibernate is populating or reading the object. ! If you want the name of the Property and not the Field to be what the consumers of your API ! use with HQL, then a Naming Strategy is needed. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term><literal>nosetter</literal></term> ! <listitem> ! <para> ! NHibernate will access the Field directly when setting the value and will use the ! Property when getting the value. This can be used when a Property only exposes a get because ! the consumers of your API can't change the value directly. A Naming Strategy is required ! because NHibernate uses the <literal>name</literal> attribute as the Property so it needs to ! be told what the name of the Field is. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term><literal>ClassName</literal></term> ! <listitem> ! <para> ! If NHibernate's built in Access Strategies are not what is needed for your situation ! then you can build your own by implementing the interface ! <literal>NHibernate.Property.IPropertyAccessor</literal>. The value of the ! <literal>access</literal> attribute should be an Assembly Qualified Name that can be ! loaded with <literal>Activator.CreateInstance(string AssemblyQualifiedName)</literal>. ! </para> ! </listitem> ! </varlistentry> ! </variablelist> </para> <para> ! <variablelist> <title>Naming Strategy</title> ! <varlistentry> ! <term><literal>camelcase</literal></term> ! <listitem> ! <para> ! The <literal>name</literal> attribute is converted to CamelCase to find the Field. ! <literal><property name="Foo" ... ></literal> uses the Field <literal>foo</literal>. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term><literal>camelcase-underscore</literal></term> ! <listitem> ! <para> ! The <literal>name</literal> attribute is converted to CamelCase and prefixed with an ! underscore to find the Field. ! <literal><property name="Foo" ... ></literal> uses the Field <literal>_foo</literal>. ! </para> ! </listitem> ! </varlistentry> ! <varlistentry> ! <term><literal>pascalcase-m-underscore</literal></term> ! <listitem> ! <para> ! The <literal>name</literal> attribute is prefixed with the character ! m and an underscore to find the Field. ! <literal><property name="Foo" ... ></literal> uses the Field <literal>m_Foo</literal>. ! </para> ! </listitem> ! </varlistentry> ! </variablelist> </para> </sect2> </sect1> --- 476,860 ---- be text formatted as <literal>access-strategy.naming-strategy</literal>. The <literal>.naming-stragey</literal> is not always required. ! <table> <title>Access Strategy</title> ! <tgroup cols="2"> ! <thead> ! <row> ! <entry>Access Strategy Name</entry> ! <entry>Description</entry> ! </row> ! </thead> ! <tbody> ! <row> ! <entry><literal>property</literal></entry> ! <entry> ! <para> ! NHibernate will access the Field directly. NHibernate uses the <literal><name></literal> ! as the name of the field. This can be used when a Property's get and set have extra ! actions in them that you don't want to occur when NHibernate is populating or reading the object. ! If you want the name of the Property and not the Field to be what the consumers of your API ! use with HQL, then a Naming Strategy is needed. ! </para> ! </entry> ! </row> ! <row> ! <entry><literal>field</literal></entry> ! <entry> ! <para> ! NHibernate will access the Field directly. NHibernate uses the <literal><name></literal> ! as the name of the field. This can be used when a Property's get and set have extra ! actions in them that you don't want to occur when NHibernate is populating or reading the object. ! If you want the name of the Property and not the Field to be what the consumers of your API ! use with HQL, then a Naming Strategy is needed. ! </para> ! </entry> ! </row> ! <row> ! <entry><literal>nosetter</literal></entry> ! <entry> ! <para> ! NHibernate will access the Field directly when setting the value and will use the ! Property when getting the value. This can be used when a Property only exposes a get because ! the consumers of your API can't change the value directly. A Naming Strategy is required ! because NHibernate uses the <literal>name</literal> attribute as the Property so it needs to ! be told what the name of the Field is. ! </para> ! </entry> ! </row> ! <row> ! <entry><literal>ClassName</literal></entry> ! <entry> ! <para> ! If NHibernate's built in Access Strategies are not what is needed for your situation ! then you can build your own by implementing the interface ! <literal>NHibernate.Property.IPropertyAccessor</literal>. The value of the ! <literal>access</literal> attribute should be an Assembly Qualified Name that can be ! loaded with <literal>Activator.CreateInstance(string AssemblyQualifiedName)</literal>. ! </para> ! </entry> ! </row> ! </tbody> ! </tgroup> ! </table> </para> <para> ! <table> <title>Naming Strategy</title> ! <tgroup cols="2"> ! <thead> ! <row> ! <entry>Naming Strategy Name</entry> ! <entry>Description</entry> ! </row> ! </thead> ! <tbody> ! <row> ! <entry><literal>camelcase</literal></entry> ! <entry> ! <para> ! The <literal>name</literal> attribute is converted to CamelCase to find the Field. ! <literal><property name="Foo" ... ></literal> uses the Field <literal>foo</literal>. ! </para> ! </entry> ! </row> ! <row> ! <entry><literal>camelcase-underscore</literal></entry> ! <entry> ! <para> ! The <literal>name</literal> attribute is converted to CamelCase and prefixed with an ! underscore to find the Field. ! <literal><property name="Foo" ... ></literal> uses the Field <literal>_foo</literal>. ! </para> ! </entry> ! </row> ! <row> ! <entry><literal>lowercase-underscore</literal></entry> ! <entry> ! <para> ! The <literal>name</literal> attribute is converted to all LowerCase and prefixed with an ! underscore to find the Field. ! <literal><property name="FooBar" ... ></literal> uses the Field <literal>_foobar</literal>. ! </para> ! </entry> ! </row> ! <row> ! <entry><literal>pascalcase-m-underscore</literal></entry> ! <entry> ! <para> ! The <literal>name</literal> attribute is prefixed with the character ! <literal>m</literal> and an underscore to find the Field. ! <literal><property name="Foo" ... ></literal> uses the Field <literal>m_Foo</literal>. ! </para> ! </entry> ! </row> ! </tbody> ! </tgroup> ! </table> </para> </sect2> </sect1> + <sect1 id="mapping-types"> + <title>NHibernate Types</title> + <sect2 id="mapping-types-entitiesvalues"> + <title>Entities and values</title> + + <para> + To understand the behaviour of various .NET language-level objects with respect + to the persistence service, we need to classify them into two groups: + </para> + + <para> + An <emphasis>entity</emphasis> exists independently of any other objects holding + references to the entity. Contrast this with the usual .NET model where an + unreferenced object is garbage collected. Entities must be explicitly saved and + deleted (except that saves and deletions may be <emphasis>cascaded</emphasis> + from a parent entity to its children). Entities support + circular and shared references. They may also be versioned. + </para> + + <para> + An entity's persistent state consists of references to other entities and + instances of <emphasis>value</emphasis> types. Values are structs, + collections, components and certain immutable objects. Unlike entities, values + (in particular collections and components) <emphasis>are</emphasis> + persisted and deleted by reachability. Since value objects (and structs) are + persisted and deleted along with their containing entity they may not be + independently versioned. Values have no independent identity, so they cannot be + shared by two entities or collections. + </para> + + <para> + All NHibernate types except collections support null semantics if the .NET type also + supports it. + </para> + + <para> + Up until now, we've been using the term "persistent class" to refer to + entities. We will continue to do that. Strictly speaking, however, not all + user-defined classes with persistent state are entities. A + <emphasis>component</emphasis> is a user defined class with value semantics. + </para> + </sect2> + <sect2 id="mapping-types-basictypes"> + <title>Basic value types</title> + + <para> + The <emphasis>basic types</emphasis> may be roughly categorized into three groups - <literal>System.ValueType</literal> + types, <literal>System.Object</literal> types, and <literal>System.Object</literal> types for large objects. Just like + the .NET Types, columns for System.ValueType types <emphasis>can not</emphasis> store <literal>null</literal> values + and System.Object types <emphasis>can</emphasis> store <literal>null</literal> values. + </para> + <table> + <title>System.ValueType Mapping Types</title> + <tgroup cols="4"> + <thead> + <row> + <entry>NHibernate Type</entry> + <entry>.NET Type</entry> + <entry>Database Type</entry> + <entry>Remarks</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal>Boolean</literal></entry> + <entry><literal>System.Boolean</literal></entry> + <entry><literal>DbType.Boolean</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Byte</literal></entry> + <entry><literal>System.Byte</literal></entry> + <entry><literal>DbType.Byte</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Char</literal></entry> + <entry><literal>System.Char</literal></entry> + <entry><literal>DbType.StringFixedLength - 1 char</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>DateTime</literal></entry> + <entry><literal>System.DateTime</literal></entry> + <entry><literal>DbType.DateTime</literal> - ignores the milliseconds</entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Decimal</literal></entry> + <entry><literal>System.Decimal</literal></entry> + <entry><literal>DbType.Decimal</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Double</literal></entry> + <entry><literal>System.Double</literal></entry> + <entry><literal>DbType.Double</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Guid</literal></entry> + <entry><literal>System.Guid</literal></entry> + <entry><literal>DbType.Guid</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Int16</literal></entry> + <entry><literal>System.Int16</literal></entry> + <entry><literal>DbType.Int16</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Int32</literal></entry> + <entry><literal>System.Int32</literal></entry> + <entry><literal>DbType.Int32</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Int64</literal></entry> + <entry><literal>System.Int64</literal></entry> + <entry><literal>DbType.Int64</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>PersistentEnum</literal></entry> + <entry>A <literal>System.Enum</literal></entry> + <entry>The <literal>DbType</literal> for the underlying value.</entry> + <entry>Do not specify <literal>type="PersistentEnum"</literal> in the mapping. Instead + specify the Assembly Qualified Name of the Enum or let NHibernate use Reflection to "guess" the Type. + The UnderlyingType of the Enum is used to determine the correct <literal>DbType</literal>.</entry> + </row> + <row> + <entry><literal>Single</literal></entry> + <entry><literal>System.Single</literal></entry> + <entry><literal>DbType.Single</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Ticks</literal></entry> + <entry><literal>System.DateTime</literal></entry> + <entry><literal>DbType.Int64</literal></entry> + <entry><literal>type="Ticks"</literal> must be specified.</entry> + </row> + <row> + <entry><literal>TimeSpan</literal></entry> + <entry><literal>System.TimeSpan</literal></entry> + <entry><literal>DbType.Int64</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Timestamp</literal></entry> + <entry><literal>System.DateTime</literal></entry> + <entry><literal>DbType.DateTime</literal> - as specific as database supports.</entry> + <entry><literal>type="Timestamp"</literal> must be specified.</entry> + </row> + <row> + <entry><literal>TrueFalse</literal></entry> + <entry><literal>System.Boolean</literal></entry> + <entry><literal>DbType.AnsiStringFixedLength</literal> - 1 char either 'T' or 'F'</entry> + <entry><literal>type="TrueFalse"</literal> must be specified.</entry> + </row> + <row> + <entry><literal>YesNo</literal></entry> + <entry><literal>System.Boolean</literal></entry> + <entry><literal>DbType.AnsiStringFixedLength</literal> - 1 char either 'Y' or 'N'</entry> + <entry><literal>type="YesNo"</literal> must be specified.</entry> + </row> + </tbody> + </tgroup> + </table> + + <table> + <title>System.Object Mapping Types</title> + <tgroup cols="4"> + <thead> + <row> + <entry>NHibernate Type</entry> + <entry>.NET Type</entry> + <entry>Database Type</entry> + <entry>Remarks</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal>AnsiString</literal></entry> + <entry><literal>System.String</literal></entry> + <entry><literal>DbType.AnsiString</literal></entry> + <entry><literal>type="AnsiString"</literal> must be specified.</entry> + </row> + <row> + <entry><literal>CultureInfo</literal></entry> + <entry><literal>System.Globalization.CultureInfo</literal></entry> + <entry><literal>DbType.String</literal> - 5 chars for culture</entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Binary</literal></entry> + <entry><literal>System.Byte[]</literal></entry> + <entry><literal>DbType.Binary</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>Type</literal></entry> + <entry><literal>System.Type</literal></entry> + <entry><literal>DbType.String</literal> holding Assembly Qualified Name.</entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + <row> + <entry><literal>String</literal></entry> + <entry><literal>System.String</literal></entry> + <entry><literal>DbType.String</literal></entry> + <entry>Default when no <literal>type</literal> attribute specified.</entry> + </row> + </tbody> + </tgroup> + </table> + + <table> + <title>Large Object Mapping Types</title> + <tgroup cols="4"> + <thead> + <row> + <entry>NHibernate Type</entry> + <entry>.NET Type</entry> + <entry>Database Type</entry> + <entry>Remarks</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal>StringClob</literal></entry> + <entry><literal>System.String</literal></entry> + <entry><literal>DbType.String</literal></entry> + <entry><literal>type="StringClob"</literal> must be specified. Entire field is read into memory.</entry> + </row> + <row> + <entry><literal>BinaryBlob</literal></entry> + <entry><literal>System.Byte[]</literal></entry> + <entry><literal>DbType.Binary</literal></entry> + <entry><literal>type="BinaryBlob"</literal> must be specified. Entire field is read into memory.</entry> + </row> + <row> + <entry><literal>Serializable</literal></entry> + <entry>Any <literal>System.Object</literal> that is marked with SerializableAttribute.</entry> + <entry><literal>DbType.Binary</literal></entry> + <entry><literal>type="Serializable"</literal> should be specified. This is the fallback type + if no NHibernate Type can be found for the Property.</entry> + </row> + </tbody> + </tgroup> + </table> + + <para> + For those of you coming over from Hibernate or using some of the tools to generate <literal>hbm.xml</literal> files + that are intended for Hibernate, there is a Hibernate compatiblity layer for type names. A <literal>type="integer"</literal> + will map to an <literal>Int32</literal> NHibernateType, <literal>type="short"</literal> to an <literal>Int16</literal> + NHibernateType. To see all of the conversions you can view the source of static constructor of the class + <literal>NHibernate.Type.TypeFactory</literal>. + </para> + </sect2> + + </sect1> *************** *** 583,586 **** </sect1> ! </chapter> ! --- 879,881 ---- </sect1> ! </chapter> \ No newline at end of file Index: architecture.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/doc/reference/en/modules/architecture.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** architecture.xml 21 Oct 2004 13:21:42 -0000 1.3 --- architecture.xml 25 Oct 2004 05:20:08 -0000 1.4 *************** *** 1,2 **** --- 1,10 ---- + <!-- + before committing make sure to comment out the DOCTYPE + It is in here to get intellisense with XMLSpy. The + HomeEdition is a free download. + + <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "../../support/docbook-dtd/docbookx.dtd"> + --> <chapter id="architecture"> *************** *** 64,68 **** Heres some definitions of the objects in the diagrams: ! <variablelist spacing="compact"> <varlistentry> <term>SessionFactory (<literal>NHibernate.ISessionFactory</literal>)</term> --- 72,76 ---- Heres some definitions of the objects in the diagrams: ! <variablelist> <varlistentry> <term>SessionFactory (<literal>NHibernate.ISessionFactory</literal>)</term> |
From: Michael D. <mik...@us...> - 2004-10-25 05:20:34
|
Update of /cvsroot/nhibernate/nhibernate/doc/reference/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8120 Modified Files: master.xml Log Message: worked on it a little bit more. Index: master.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/doc/reference/en/master.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** master.xml 19 Oct 2004 04:32:02 -0000 1.1 --- master.xml 25 Oct 2004 05:20:25 -0000 1.2 *************** *** 89,97 **** </para> - </preface> ! ! ! &architecture; &basic-mapping; --- 89,94 ---- </para> </preface> ! &architecture; &basic-mapping; |
From: Michael D. <mik...@us...> - 2004-10-24 21:42:49
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28327/NHibernate/Cache Modified Files: Timestamper.cs Log Message: Fixed up Timestamper to be more like hibernate. Not sure the old impl was at all correct. Index: Timestamper.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cache/Timestamper.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Timestamper.cs 6 May 2004 20:53:59 -0000 1.6 --- Timestamper.cs 24 Oct 2004 21:42:40 -0000 1.7 *************** *** 13,35 **** public sealed class Timestamper { private static short counter = 0; private static long time; private const int BinDigits = 12; ! public const short OneMs = 1<<BinDigits; - [MethodImpl(MethodImplOptions.Synchronized)] public static long Next() { ! long newTime = System.DateTime.Now.Ticks << BinDigits; //is this right? ! if (time < newTime) ! { ! time = newTime; ! counter = 0; ! } ! else if (counter < OneMs - 1) { ! counter++; } - return time + counter; } --- 13,46 ---- public sealed class Timestamper { + private static object lockObject = new object(); + + // hibernate is using System.currentMilliSeconds which is calculated + // from jan 1, 1970 + private static long baseDateMs = (new DateTime(1970, 1, 1).Ticks)/10000; + private static short counter = 0; private static long time; private const int BinDigits = 12; ! public const short OneMs = 1<<BinDigits; //(4096 is the value) public static long Next() { ! lock( lockObject ) { ! // Ticks is accurate down to 100 nanoseconds - hibernate uses milliseconds ! // to help calculate next time so drop the nanoseconds portion.(1ms==1000000ns) ! long newTime = ( (System.DateTime.Now.Ticks/10000) - baseDateMs ) << BinDigits; ! if (time < newTime) ! { ! time = newTime; ! counter = 0; ! } ! else if (counter < OneMs - 1) ! { ! counter++; ! } ! return time + counter; ! } } |
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/PropertyTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5010/NHibernate.Test/PropertyTest Modified Files: FieldAccessorFixture.cs FieldClass.cs FieldGetterFixture.cs NoSetterAccessorFixture.cs NoSetterCamelCaseFixture.cs NoSetterCamelCaseUnderscoreFixture.cs NoSetterPascalCaseMUnderscoreFixture.cs Added Files: FieldCamelCaseFixture.cs FieldCamelCaseUnderscoreFixture.cs FieldLowerCaseUnderscoreFixture.cs FieldPascalCaseMUnderscoreFixture.cs NoSetterLowerCaseUnderscoreFixture.cs Removed Files: CamelCaseFixture.cs CamelCaseUnderscoreFixture.cs PascalCaseMUnderscoreFixture.cs Log Message: NH-118 and a refactoring of TestFixture to make it easier to add new naming strategies for Properties. Index: NoSetterCamelCaseFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/PropertyTest/NoSetterCamelCaseFixture.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NoSetterCamelCaseFixture.cs 23 Aug 2004 13:13:25 -0000 1.1 --- NoSetterCamelCaseFixture.cs 23 Oct 2004 15:44:08 -0000 1.2 *************** *** 20,24 **** _getter = _accessor.GetGetter( typeof(FieldClass), "CamelBaz" ); _setter = _accessor.GetSetter( typeof(FieldClass), "CamelBaz" ); ! _instance = new FieldClass( 6, -1, 2, 0 ); } --- 20,25 ---- _getter = _accessor.GetGetter( typeof(FieldClass), "CamelBaz" ); _setter = _accessor.GetSetter( typeof(FieldClass), "CamelBaz" ); ! _instance = new FieldClass(); ! _instance.InitCamelBaz( 0 ); } --- NEW FILE: FieldLowerCaseUnderscoreFixture.cs --- using System; using NHibernate.Property; using NUnit.Framework; namespace NHibernate.Test.PropertyTest { /// <summary> /// Summary description for FieldLowerCaseUnderscoreFixture. /// </summary> [TestFixture] public class FieldLowerCaseUnderscoreFixture : FieldAccessorFixture { [SetUp] public override void SetUp() { _accessor = PropertyAccessorFactory.GetPropertyAccessor("field.lowercase-underscore"); _getter = _accessor.GetGetter( typeof(FieldClass), "LowerUnderscoreFoo" ); _setter = _accessor.GetSetter( typeof(FieldClass), "LowerUnderscoreFoo" ); _instance = new FieldClass(); _instance.InitLowerUnderscoreFoo( 0 ); } } } --- CamelCaseFixture.cs DELETED --- --- NEW FILE: FieldCamelCaseUnderscoreFixture.cs --- using System; using NHibernate.Property; using NUnit.Framework; namespace NHibernate.Test.PropertyTest { /// <summary> /// Summary description for FieldCamelCaseUnderscoreFixture. /// </summary> [TestFixture] public class FieldCamelCaseUnderscoreFixture : FieldAccessorFixture { [SetUp] public override void SetUp() { _accessor = PropertyAccessorFactory.GetPropertyAccessor("field.camelcase-underscore"); _getter = _accessor.GetGetter( typeof(FieldClass), "CamelUnderscoreFoo" ); _setter = _accessor.GetSetter( typeof(FieldClass), "CamelUnderscoreFoo" ); _instance = new FieldClass(); _instance.InitCamelUnderscoreFoo( 0 ); } } } Index: NoSetterAccessorFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/PropertyTest/NoSetterAccessorFixture.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NoSetterAccessorFixture.cs 23 Aug 2004 13:13:25 -0000 1.1 --- NoSetterAccessorFixture.cs 23 Oct 2004 15:44:08 -0000 1.2 *************** *** 21,24 **** --- 21,25 ---- protected bool _expectedCamelBazGetterCalled = false; protected bool _expectedCamelUnderscoreFooGetterCalled = false; + protected bool _expectedLowerUnderscoreFooGetterCalled = false; /// <summary> *************** *** 40,46 **** --- 41,49 ---- _instance.Increment(); Assert.AreEqual( 1, _getter.Get(_instance) ); + Assert.AreEqual( _expectedBlahGetterCalled, _instance.BlahGetterCalled ); Assert.AreEqual( _expectedCamelBazGetterCalled, _instance.CamelBazGetterCalled ); Assert.AreEqual( _expectedCamelUnderscoreFooGetterCalled, _instance.CamelUnderscoreFooGetterCalled ); + Assert.AreEqual( _expectedLowerUnderscoreFooGetterCalled, _instance.LowerUnderscoreFooGetterCalled ); } --- NEW FILE: FieldCamelCaseFixture.cs --- using System; using NHibernate.Property; using NUnit.Framework; namespace NHibernate.Test.PropertyTest { /// <summary> /// Summary description for FieldCamelCaseFixture. /// </summary> [TestFixture] public class FieldCamelCaseFixture : FieldAccessorFixture { [SetUp] public override void SetUp() { _accessor = PropertyAccessorFactory.GetPropertyAccessor("field.camelcase"); _getter = _accessor.GetGetter( typeof(FieldClass), "CamelBaz" ); _setter = _accessor.GetSetter( typeof(FieldClass), "CamelBaz" ); _instance = new FieldClass(); _instance.InitCamelBaz( 0 ); } } } --- PascalCaseMUnderscoreFixture.cs DELETED --- Index: FieldGetterFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/PropertyTest/FieldGetterFixture.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FieldGetterFixture.cs 23 Oct 2004 15:01:22 -0000 1.1 --- FieldGetterFixture.cs 23 Oct 2004 15:44:08 -0000 1.2 *************** *** 58,61 **** --- 58,74 ---- [Test] + public void LowerCaseUnderscoreNamingStrategy() + { + IGetter fieldGetter = ReflectHelper.GetGetter( typeof(FieldGetterFixture.FieldGetterClass), "PropertyFour" ); + + Assert.IsNotNull( fieldGetter, "should have found getter" ); + Assert.AreEqual( typeof(FieldGetter), fieldGetter.GetType(), "IGetter should be for a field." ); + Assert.AreEqual( typeof(Int64), fieldGetter.ReturnType, "returns Int64." ); + Assert.IsNull( fieldGetter.Property, "no PropertyInfo for fields." ); + Assert.IsNull( fieldGetter.PropertyName, "no Property Names for fields." ); + Assert.AreEqual( Int64.MaxValue, fieldGetter.Get( obj ), "Get() for Int64" ); + } + + [Test] public void PascalCaseMUnderscoreNamingStrategy() { *************** *** 76,79 **** --- 89,93 ---- private bool _propertyTwo = true; private TimeSpan m_PropertyThree = new TimeSpan( DateTime.Parse("2001-01-01" ).Ticks ); + private long _propertyfour = Int64.MaxValue; } } Index: NoSetterCamelCaseUnderscoreFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/PropertyTest/NoSetterCamelCaseUnderscoreFixture.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NoSetterCamelCaseUnderscoreFixture.cs 23 Aug 2004 13:13:25 -0000 1.1 --- NoSetterCamelCaseUnderscoreFixture.cs 23 Oct 2004 15:44:08 -0000 1.2 *************** *** 21,25 **** _getter = _accessor.GetGetter( typeof(FieldClass), "CamelUnderscoreFoo" ); _setter = _accessor.GetSetter( typeof(FieldClass), "CamelUnderscoreFoo" ); ! _instance = new FieldClass( 6, 0, -1, 2 ); } --- 21,26 ---- _getter = _accessor.GetGetter( typeof(FieldClass), "CamelUnderscoreFoo" ); _setter = _accessor.GetSetter( typeof(FieldClass), "CamelUnderscoreFoo" ); ! _instance = new FieldClass(); ! _instance.InitCamelUnderscoreFoo( 0 ); } Index: NoSetterPascalCaseMUnderscoreFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/PropertyTest/NoSetterPascalCaseMUnderscoreFixture.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** NoSetterPascalCaseMUnderscoreFixture.cs 23 Aug 2004 13:13:25 -0000 1.1 --- NoSetterPascalCaseMUnderscoreFixture.cs 23 Oct 2004 15:44:08 -0000 1.2 *************** *** 21,25 **** _getter = _accessor.GetGetter( typeof(FieldClass), "Blah" ); _setter = _accessor.GetSetter( typeof(FieldClass), "Blah" ); ! _instance = new FieldClass( 6, -1, 0, 2 ); } --- 21,26 ---- _getter = _accessor.GetGetter( typeof(FieldClass), "Blah" ); _setter = _accessor.GetSetter( typeof(FieldClass), "Blah" ); ! _instance = new FieldClass(); ! _instance.InitBlah( 0 ); } --- NEW FILE: FieldPascalCaseMUnderscoreFixture.cs --- using System; using NHibernate.Property; using NUnit.Framework; namespace NHibernate.Test.PropertyTest { /// <summary> /// Summary description for FieldPascalCaseMUnderscoreFixture. /// </summary> [TestFixture] public class FieldPascalCaseMUnderscoreFixture : FieldAccessorFixture { [SetUp] public override void SetUp() { _accessor = PropertyAccessorFactory.GetPropertyAccessor("field.pascalcase-m-underscore"); _getter = _accessor.GetGetter( typeof(FieldClass), "Blah" ); _setter = _accessor.GetSetter( typeof(FieldClass), "Blah" ); _instance = new FieldClass(); _instance.InitBlah( 0 ); } } } Index: FieldClass.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/PropertyTest/FieldClass.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FieldClass.cs 23 Aug 2004 13:13:25 -0000 1.3 --- FieldClass.cs 23 Oct 2004 15:44:08 -0000 1.4 *************** *** 8,26 **** public class FieldClass { ! private int Id; ! private int _camelUnderscoreFoo; ! private int m_Blah; ! private int camelBaz; public bool CamelUnderscoreFooGetterCalled = false; public bool BlahGetterCalled = false; public bool CamelBazGetterCalled = false; ! public FieldClass(int Id, int _camelUnderscoreFoo, int m_Blah, int camelBaz ) { ! this.Id = Id; ! this._camelUnderscoreFoo = _camelUnderscoreFoo; ! this.m_Blah = m_Blah; ! this.camelBaz = camelBaz; } --- 8,49 ---- public class FieldClass { ! private int Id = 1; ! private int _camelUnderscoreFoo = 2; ! private int m_Blah = 3; ! private int camelBaz = 4; ! private int _lowerunderscorefoo = 5; public bool CamelUnderscoreFooGetterCalled = false; public bool BlahGetterCalled = false; public bool CamelBazGetterCalled = false; + public bool LowerUnderscoreFooGetterCalled = false; ! public FieldClass( ) ! { ! } ! ! public void InitId(int value) { ! Id = value; ! } ! ! public void InitCamelUnderscoreFoo(int value) ! { ! _camelUnderscoreFoo = value; ! } ! ! public void InitBlah(int value) ! { ! m_Blah = value; ! } ! ! public void InitCamelBaz(int value) ! { ! camelBaz = value; ! } ! ! public void InitLowerUnderscoreFoo(int value) ! { ! _lowerunderscorefoo = value; } *************** *** 31,34 **** --- 54,58 ---- m_Blah++; camelBaz++; + _lowerunderscorefoo++; } *************** *** 42,45 **** --- 66,70 ---- } + public int Blah { *************** *** 59,62 **** --- 84,96 ---- } } + + public int LowerUnderscoreFoo + { + get + { + LowerUnderscoreFooGetterCalled = true; + return _lowerunderscorefoo; + } + } } } Index: FieldAccessorFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/PropertyTest/FieldAccessorFixture.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FieldAccessorFixture.cs 23 Aug 2004 13:13:25 -0000 1.3 --- FieldAccessorFixture.cs 23 Oct 2004 15:44:08 -0000 1.4 *************** *** 32,36 **** _getter = _accessor.GetGetter( typeof(FieldClass), "Id" ); _setter = _accessor.GetSetter( typeof(FieldClass), "Id" ); ! _instance = new FieldClass( 0, 6, -1, 2 ); } --- 32,37 ---- _getter = _accessor.GetGetter( typeof(FieldClass), "Id" ); _setter = _accessor.GetSetter( typeof(FieldClass), "Id" ); ! _instance = new FieldClass(); ! _instance.InitId( 0 ); } *************** *** 46,49 **** --- 47,51 ---- Assert.IsFalse( _instance.CamelBazGetterCalled ); Assert.IsFalse( _instance.CamelUnderscoreFooGetterCalled ); + Assert.IsFalse( _instance.LowerUnderscoreFooGetterCalled ); } --- CamelCaseUnderscoreFixture.cs DELETED --- --- NEW FILE: NoSetterLowerCaseUnderscoreFixture.cs --- using System; using NHibernate.Property; using NUnit.Framework; namespace NHibernate.Test.PropertyTest { /// <summary> /// Summary description for NoSetterLowerCaseUnderscoreFixture. /// </summary> [TestFixture] public class NoSetterLowerCaseUnderscoreFixture : NoSetterAccessorFixture { [SetUp] public override void SetUp() { _expectedLowerUnderscoreFooGetterCalled = true; _accessor = PropertyAccessorFactory.GetPropertyAccessor("nosetter.lowercase-underscore"); _getter = _accessor.GetGetter( typeof(FieldClass), "LowerUnderscoreFoo" ); _setter = _accessor.GetSetter( typeof(FieldClass), "LowerUnderscoreFoo" ); _instance = new FieldClass(); _instance.InitLowerUnderscoreFoo( 0 ); } } } |
From: Michael D. <mik...@us...> - 2004-10-23 15:44:17
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Property In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5010/NHibernate/Property Modified Files: PropertyAccessorFactory.cs Added Files: LowerCaseUnderscoreStrategy.cs Log Message: NH-118 and a refactoring of TestFixture to make it easier to add new naming strategies for Properties. Index: PropertyAccessorFactory.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Property/PropertyAccessorFactory.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** PropertyAccessorFactory.cs 23 Oct 2004 15:01:21 -0000 1.5 --- PropertyAccessorFactory.cs 23 Oct 2004 15:44:09 -0000 1.6 *************** *** 22,28 **** --- 22,30 ---- accessors["field.camelcase-underscore"] = new FieldAccessor( new CamelCaseUnderscoreStrategy() ); accessors["field.pascalcase-m-underscore"] = new FieldAccessor( new PascalCaseMUnderscoreStrategy() ) ; + accessors["field.lowercase-underscore"] = new FieldAccessor( new LowerCaseUnderscoreStrategy() ); accessors["nosetter.camelcase"] = new NoSetterAccessor( new CamelCaseStrategy() ); accessors["nosetter.camelcase-underscore"] = new NoSetterAccessor( new CamelCaseUnderscoreStrategy() ); accessors["nosetter.pascalcase-m-underscore"] = new NoSetterAccessor( new PascalCaseMUnderscoreStrategy() ); + accessors["nosetter.lowercase-underscore"] = new NoSetterAccessor( new LowerCaseUnderscoreStrategy() ); } *************** *** 116,123 **** /// <term>pascalcase-m-underscore</term> /// <description> ! /// The <c>name</c> attribute should be changed to CamelCase to find the field. /// <c><property name="Foo" ... ></c> finds a field <c>m_Foo</c>. /// </description> /// </item> /// </list> /// <para> --- 118,134 ---- /// <term>pascalcase-m-underscore</term> /// <description> ! /// The <c>name</c> attribute should be prefixed with an 'm' and underscore ! /// to find the field. /// <c><property name="Foo" ... ></c> finds a field <c>m_Foo</c>. /// </description> /// </item> + /// <item> + /// <term>lowercase-underscore</term> + /// <description> + /// The <c>name</c> attribute should be changed to lowercase and prefixed with + /// and underscore to find the field. + /// <c><property name="FooBar" ... ></c> finds a field <c>_foobar</c>. + /// </description> + /// </item> /// </list> /// <para> --- NEW FILE: LowerCaseUnderscoreStrategy.cs --- using System; namespace NHibernate.Property { /// <summary> /// Implementation of FieldNamingStrategy for fields that are prefixed with /// an underscore and the PropertyName is changed to lower case. /// </summary> public class LowerCaseUnderscoreStrategy : IFieldNamingStrategy { #region IFieldNamingStrategy Members public string GetFieldName(string propertyName) { return "_" + propertyName.ToLower(); } #endregion } } |