Applied Patrick Earl's patch, adding event ModelCreated that allows to re-configure...
[castle.git] / ActiveRecord / Changes.txt
blobe706509b997afab96ac89bd2612c86457ddbe655
1 Release Candidate 2
2 ===================
4 - Applied Patrick Earl's patch, adding event ModelCreated that allows to re-configure the model before 
5   generating the XML for NHibernate.
7 - Added HqlNamedQuery attribute and allowed to use the Import attribute at the assembly level
9 - Applied Brian Romanko's patch fixing AR-104
10   "IsUniqueValidator does not work properly with nullable primary keys"
12 - Add Count(ICriterion[] criteria) overrides to ActiveRecordMediator and ActiveRecordMediator.Generic (original patch from Andy W. Dobbels)
14 - Fixed AR-120 
15   "Add support for the <Operation>AndFlush family of methods to ActiveRecordMediator"
17 - Applied Jan Persson's patch fixing AR-122
18   "Problems validating inherited properties when using generics"
20 - Applied Edward Kreis' patch fixing AR-124
21   "ActiveRecord OneToOne attribute's "constrained" parameter doesn't appears in a NHibernate mappings"
23 - Applied John Hurrell's patch fixing AR-123 
24   "Additional OnFlush functionality"
26 - Exposed some IValidator's properties.
28 - Renamed IActiveRecordQuery.Target to IActiveRecordQuery.RootType
30 - Added SetRange to ProjectionQuery<,>
32 - Made HasMany a bit smarter when dealing with Map elements. 
34     AR now can guess the IndexType, the MapType and the Table name from the IDictionary<,> property.
35     (DotNet 2 only.)
37 - AR-118 added NoSetter.LoweCase property access option.
39 - Fixed AR-117 "ActiveRecordBase CRUD Methods Ignore SessionScope FlushMode"
41     The operations Save, Create, Delete, Update will not flush the session anymore
42     The operations SaveAndFlush, CreateAndFlush, DeleteAndFlush, UpdateAndFlush will
44 - Removed HqlBasedQuery.Count operation as it didn't work for complex queries
46 - Fixed AR-110 "Support rollback on TransactionScope Dispose without commit."
47   
48   Now you can create a TransactionScope defining the behavior
49   if the dispose is reached and neither a votecommit nor voterollback was called
51 - Applied Andrew Peters' (see AR-105) with the following changes
53         - [breaking change] Renames ActiveRecordBase.CountAll to ActiveRecordBase.Count 
54           as several overloads are by criteria and IMHO Count is a better, more general name.
56         - Adds an overload of Count that accepts an ICriterion[] - Modified CountQuery 
57           to use NHibernate 1.2 Projections
59         - Reimplements (http://support.castleproject.org//browse/AR-100) so that it uses 
60           the new Count overload instead of FindAll.
62         - Filled in as many missing doc comments as I could before my eyes hurt :-)
64         - Renamed "criterias" to "criteria" in method signatures - "criterias" is not a word.
66         - Reformatted code. 
68 - Fixed AR-115 Exists always returns True for lazily-proxied classes
69   Changed FindByPK to use Get/Load according to its parameters.
71 - Included PrimaryKeyType.Custom and property CustomGenerator:Type
72   allowing one to supply its own generator
74 - Included PrimaryKeyType.Counter and PrimaryKeyType.Increment
76 - Applied patch from Drew Burlingame 
77   Add ActiveRecordBase<T>.Exists(params ICriterion[] criterias) 
78   Method also added to ActiveRecordBase.
80 - Applied patch by Andrew Peters fixing AR-97
81   "Pluralization of table names"
82   
83   This patch introduces the pluralizeTableNames attribute on the configuration
84   which, if set to true, pluralizes the ActiveRecord types tables where no name
85   was specified.
86   
87   For example:
88   
89   [ActiveRecord]
90   public class Student : ActiveRecordBase<Student>
91   
92   The table name will be infered as 'Students'
93   
95 - Applied patch by Ernst Naezer fixing AR-93
96   "Scaffolding / ARdatabind crash when Typeof is not supplied in the HasMany attribute."
98 - Applied Lee Henson's patch fixing AR-88
99   "Move GetFieldOrPropertyValue from ConfirmationValidator to AbstractValidator"
101 - Applied Lee Henson's patch fixing AR-86
102   "Expose DetachedCriteria on ActiveRecordBase<T>.SlicedFindAll"
104 - Fixed AR-84:  ActiveRecord TransactionScope should export interface to set IsolationLevel
105   Now you can specify the isolation level when you create a TransactionScope
107 - Applied Carlos Ble's patch adding Replicate support to ActiveRecordBase
109 - Moved ProjectionQuery and ScalarProjectionQuery to Castle.ActiveRecord.Queries, with the rest of the queries.
111 - Added untyped projection support, using just ProjectionQuery<Post>, which uses object[] tuples.
113 - Added real projection support, which allows the following code:
114 ProjectionQuery<Post, PostTitleAndId> proj = new ProjectionQuery<Post, PostTitleAndId>(
115         Projections.Property("Title"), Projections.Property("Id"));
116 ICollection<PostTitleAndId> posts = proj.Execute();
117 foreach(PostTitleAndId titleAndId in posts)
119         PostsList.Add( new ListItem(titleAndId.Title, titleAndId.Id) );
120         
123 - Renamed ProjectionQuery<T> ScalarProjectionQuery<T>, in preperation for real projections.
125 - Added DetachCrietia support in ARBase<T>, which allows integration with NQG, and in general enables taking advantage of the full criteria API.
126    Improved methods are FindOne, FindAll, FindFirst
127    
128 - Move to used NHibernate 1.2 rev #2352
130 - Applied Josh Robb's patch adding a check for isWeb=true on the Session module.
132 - Returned to the default lazy false behavior.
134 - Will automatically initialize entities when loading outside of scope.
136 - Removed IModelNode since it was no longer of any value.
138 - Added XML Documentation to all public/ protected methods
140 - Moved to using NHibernate 1.2 beta 1
141   IEntityPersister instead of IClassPersister
142   I had some issues with Nullables.dll support, but mainly because the hard coded version number.
143   Different DB Tests failed because of the way NHibernate changed transaction handling (more thorough cleansing of them), I manually saved the transaction executed, and they tests pass now.
144   
145   I added type guessing to ISet<> (set), IList<> (bag), ICollection<> (bag), IDictionary<>(map)
146   
147   The nicest new feature IMO is this:
148   
149   ProjectionQuery<Blog, int> proj = new ProjectionQuery<Blog, int>(Projections.RowCount());
150   int rowCount = proj.Execute();
151   Assert.AreEqual(1, rowCount);
154 Release Candidate 1
155 ===================
157 - Changed name of mapping files generated when isDebug=true. They now follow the NHibernate convention of name.hbm.xml
159 - Refactored: CompositeKey is not a class level attribute anymore
160   (minor breaking change)
162   Instead of
164     [PrimaryKey]
165     public SomeClass Id { get/set }
166     
167   You must use
169     [CompositeKey]
170     public SomeClass Id { get/set }
171   
173 - Added support for queries using the SQL language instead of HQL, 
174   on classes derived from HqlBasedQuery (SimpleQuery, ScalarQuery, etc).
176 - Added ActiveRecordModel.GetModels(), which returns an array containing every registered ActiveRecordModel.
178 - Fixed AR-53
179   "Unique key on multiple columns"
181   Introduced UniqueKey on PropertyAttribute and FieldAttribute
182   
183 - Introduced the following properties on PropertyAttribute and FieldAttribute:
185   - Index
186   - SqlType
187   - Check
189 - Fixed AR-78 
190   "Allow users to specify autoImport"
191   
192   Use the property UseAutoImport on ActiveRecordAttribute to control auto-import
194 - Resynched ActiveRecordAttribute with NHibernate <class> mapping. Added:
196   - SelectBeforeUpdate
197   - Polymorphism
198   - Mutable
199   - BatchSize
200   - Locking
202 - Fixed AR-31
203   "Create property CustomPersister or Persister (Type) on ActiveRecordAttribute"
204   
205   Added Persister property to ActiveRecordAttribute
207 - Applied Marc-André's patch fixing AR-79
208   "ValidateIsUnique not working with TransactionScope"
210 - Added XmlIgnore to IDictionary field on ARValidationBase
212 - Added support for generic abstract base class for a type hierarchy per discussions with Don
213   Morrison on IRC. The Generic Abstract Base class must conform to all the previous rules to 
214   implement an abstract base class in a type hierarchy.
216   When initializing the class using the ActiveRecordStarter, you must use syntax similar to the
217   following:
219     ActiveRecordStarter.Initialize( GetConfigSource(),
220       typeof(Model.GenericModel.Entity<>), 
221       typeof(CompanyEntity), 
222       typeof(PersonEntity));
224   Please see the GenericJoinedSubClassTestCase.cs for an example.
226   All rules about covariance and contravariance still apply.
228 - Applied Michael Morton's patch adding support to NHibernate's INamingStrategy. 
229   This allow one to associate an implementation of INamingStrategy
230   through an attribute 'namingstrategytype' on activerecord config node
232 - Applied suggestion from Gokhan Altinoren fixing AR-77
233   "VisitPrimaryKey fails to generate correct <generator> xml 
234   element for PrimaryKeyType.Identity when the system culture is set to Turkish"
236 - Applied Michael Morton's patch fixing AR-76
237   "SemanticVerifierVisitor Issue With NHibernate User Types"
239 - Refactored CompositeKey support. Now instead of using 
241     [PrimaryKey]
242     public SomeClass Id { get/set }
243   
244     [CompositeKey]
245     public class SomeClass { ...
246   
247   You should use
249     [CompositeKey]
250     public SomeClass Id { get/set }
251         
252   The old way is still supported though.
254 - Applied Freyr Magnússon's patch fixing AR-75 
255   "SemanticVerifierVisitor causing fauly xml when using composit key"
257 - Added support for "ColumnPrefix" on [Nested] attribute. This change allows
258   a better usage of components, such as:
260     public class Name {
261       private String first, last;
262       
263       [Property("first_name")] public string First { ... }
264       [Property("last_name")] public string Last { ... }
265     }
266     
267     [ActiveRecord("children")]
268     public class Child {
269       private Name name, fatherName, motherName;
270       
271       /* maps to database columns: first_name and last_name */
272       [Nested] Name Name { ... }
273       
274       /* maps to database columns: father_first_name and father_last_name */
275       [Nested(ColumnPrefix="father_")] Name FatherName { ... }
276       
277       /* maps to database columns: mother_first_name and mother_last_name */
278       [Nested(ColumnPrefix="mother_")] Name MotherName { ... }
279     }
281 - Review OneToOneAttribute test case, added one more unit test
283 - Removed OuterJoin attribute from OneToOneAttribute, replaced by Fetch property
285 - Added PropertyRef to OneToOneAttribute
287 - Applied patch to patch from josh robb - FindAllByProperty now handles null values internallly.
289 - Applied patch from josh robb - FindAllByProperty now handles null values internallly.
291 - Applied Freyr Magnússon's patch fixing misbehave related to abstract classes that defines different
292   database boundaries: "ActiveRecordStarter Initialize method assembply overloads fail 
293   to add derived base types from config"
295 - Applied josh robb's patch "small fixup for length 
296   validator error messages where there is only a minimum or maximum specified"
298 - Fixed AR-73: "Dynamic type adding after initialization"
300 - Added some logging. That's just a start: the idea is to increase AR verbosity 
301   in order to reduce the need of debugging to diagnose problems.
303 - Refactored ActiveRecordStarter.Initialize to use ActiveRecordSectionHandler.Instance
305 - Introduced ActiveRecordSectionHandler.Instance to avoid repetitive code.
306   Now, instead of
307   
308   IConfiguration source = (IConfiguration) ConfigurationSettings.GetSection("activerecord");
309   
310   (or similar) you can use
311   
312   IConfiguration source = ActiveRecordSectionHandler.Instance;
313   
314   Bare in mind that it looks for a section named "activerecord" on the configuration
315   file associated with the AppDomain, and throws an exception if it cannot be found.
317 - Applied Marc-Andre's patch fixing AR-68
318   "Make ActiveRecordValidation.ValidationErrorMessages virtual to simplify localisation"
320 - Added SessionScope.Current static property to gain access to the
321   current ISessionScope implementation
323 - Changed ISessionScope:
324     Added FlushAction property
325     Added Flush method to allow people to have more control on when to flush
327 - Applied patch by Michael Morton <mmorton@wickednite.com>. Quoting explanation:
329 Since the generic base class varies with the type parameter 
330 (i.e. ActiveRecordBase<One> is not the same as ActiveRecordBase<Two>) 
331 there is no easy way to specify multiple configurations using the 
332 "type=" attribute.  There is also no easy way to create multiple 
333 subclasses as the documentation suggests for when using the non 
334 generic base class.
336 However, there is an easy fix for this.  Even though, for example, 
337 these two base types are "different", ActiveRecordBase<One> and 
338 ActiveRecordBase<Two>, they share the same generic type definition, 
339 namely "ActiveRecordBase`1".  With a small change to the function 
340 "GetRootType" in "SessionFactoryHolder.cs" to make it look at the 
341 generic type definition when dealing with a generic type, instead 
342 of the generic type itself, you can once again easily access multiple databases.
344 Usage:
345 You can now create multiple base types for each of your databases, such as...
347 class MyBaseOne<T> : ActiveRecordBase<T> { }
348 class MyBaseTwo<T> : ActiveRecordBase<T> { }
350 ... and then specify config for each by using the "type=" attribute like so ...
352 <config type="MyBaseOne`1, MyAssembly">
353 </config>
354 <config type="MyBaseTwo`1, MyAssembly">
355 </config>
357 Any subclasses of those will then get the correct configuration 
358 settings.  I have been using this change in my own builds for a 
359 couple weeks now and it seems to be working ok.  I have not 
360 written any tests specifically for it, yet, but wanted to get 
361 it out there in case anyone was interested.
363 - Applied patch by Brian Romanko <me@brianromanko.com> allowing the use 
364   of different type for a Nested type (what NHibernate refers as a Component)
366 - Fixed AR-65: ActiveRecordBase<T> prevent users from using type inheritance
367   Refactored ActiveRecordBase<T> to extend ActiveRecordBase
368   Refactored ActiveRecordMediator<T> to extend ActiveRecordMediator
369   Could not do the same thing for the validation<T>
371 - Removed dependency on the Nullables library.
373 - Added native support for .NET 2.0 Nullables.
375 - Applied Brian Romanko <me@brianromanko.com> patch fixing enum support
377 - Fixed AR-62: DifferentDatabaseScope not switching between databases
379 - Introduced HybridWebThreadScopeInfo which, as the name implies, 
380   uses both strategies to handle scope storage. Useful only for some complex scenarios
382 - Added support for RelationType.List.
384 - Simplified Exists<PkType> method on ActiveRecordBase<T>.
386 - Fixed AR-46 - OneToOne Attribute Does Not Support Specifying a Target Type
387   Added property MapType to OneToOne attribute
389 - Added ActiveRecordStarter.ResetInitializationFlag. Useful for test cases 
390   that invoke Initialize multiple times
392 - Fixed AR-52 - Dont allow one to invoke Initialize more than once
394 - Added some flexibility into ActiveRecord Queries. They are now mutable,
395   which means we now have methods like 'SetParameter', 'SetParameterList' and
396   'SetRange'; and the 'Query' property is now read-write.
398 - Added support for query modifiers in ActiveRecord Queries. Any object implementing
399   IQueryModifier can be added to an ActiveRecordBaseQuery, using the 
400   (protected) 'AddModifier' method. Parameters and query ranges 
401   are implemented as query modifiers.
403 - Fixed AR-39: Added virtual to IsValid on ActiveRecordValidationBase/<T>
405 - Fixed AR-45: Added BindingFlags.NonPublic to DefaultBindingFlags on ActiveRecordModelBuilder
407 - Added Element to RelationAttribute, now can map relations of simple types
408    Usage:
409          [HasMany(typeof(string), "ItemId", "Elements", Element = "Name")]
411 - Applied Antonio's patches 
412   See http://forum.castleproject.org/posts/list/457.page and 
413       http://forum.castleproject.org/posts/list/566.page
415 - Added Debug to IConfiguration Source. If set then XmlGenerationVisitor will save nhibernate mapping files to the AppDomain.BaseDirectory. 
416   Usage: if you're the XmlConfigurationSource or the Section add the isDebug="true" attribute
418 - Added support to CompositeKeys as Foreign Keys (kudos to G. Richard Bellamy)
420   BelongsToAttribute - Added CompositeKeyColumns property.
421   HasAndBelongsToManyAttribute - Added CompositeKeyColumnKeys and CompositeKeyColumnRefs.
422   HasManyAttribute - Added CompositeKeyColumnKeys.
423   VersionAttribute - Added support for UnsavedValue.
424   SemanticVerifierVisitor - Added checks to ensure the composite key attributes are used properly.
425   XmlGenerationVisitor - Added output to support mapping the composite key attributes, as well as the unsaved-value attribute for Version.
427   In general, the changes are motivated by the need to have AR map to 
428   legacy data, where composite keys are used as both primary and foreign 
429   keys. The current AR support for CompositeKeys does not support 
430   associations, this patch does.
432   There are some caveats when using this, which are driven by the NH 
433   implementation. An assigned identifier (like all CompositeKeys and 
434   many string PrimaryKeys) cannot be used to determine whether an instance 
435   is detached or transient - since it's assigned by the application, it's 
436   never null. Therefore, you must use another strategy, NH will misbehave 
437   around the way it persists the instance to the database. That is why the 
438   VersionAttribute had to have the support for UnsavedValue - the UnsavedValue 
439   property of the Version is used by NH to determine the state of the instance.
441   For a discussion of the appropriate mappings and usage, see "Hibernate in Action," pgs. 330 - 335.
443 - Added SessionScopeWebModule which hooks BeginRequest and EndRequest initializing and 
444   destructing a SessionScope properly. In order to use it add to httpModules section 
445   (web.config):
446   
447   <system.web>
448     <httpModules>
449       <add name="ar.sessionscope" type="Castle.ActiveRecord.Framework.SessionScopeWebModule, Castle.ActiveRecord" />
450     </httpModules>
451   </system.web>
453 - Added lifecycle methods that can be overriden:
455   . OnSave
456   . OnUpdate
457   . OnLoad(id)
458   . OnDelete
460 - Applied patch from Ahmed Ghandour <aghandour@rydexinvestments.com> adding the methods
461   FetchCount and Exists to ActiveRecordBase
463 - Applied patch from Dave Godfrey fixing nested classes with relations problems (http://forum.castleproject.org/posts/list/457.page)
465 - Fixed a stack overflow exception when using IsUnique inside a session scope.
467 - You can now apply IsUnique to a property that also has PrimaryKey on it without problem.
469 - Resolved IsUnique bug with ActiveRecordValidationBase<> (it was non functional)
471 - Resolved test bugs with IsUnique for .net 1 and .net 2.
473 - Refactored query support:
474   - Introduced generic interface IActiveRecordQuery<T>, extending IActiveRecordQuery, for strongly-typed Execute() method support;
475   - Added IActiveRecordQuery.Enumerate(), for memory-intensive queries;
476   - Introduced HqlBasedQuery, decoupling ActiveRecordBaseQuery from HQL usage;
478 - Added ValidateCreditCard validation attribute.
480 - Added ValidateLength validation attribute.
482 - Added support for .Net 2.0 Connection Strings in the config file, using this method:
484 <activerecord>
485         <add key="hibernate.connection.connection_string" value="ConnectionString = ${ConnectionStringKey}" />
486 </activerecord>
488 <connectionStrings>
489         <add name="ConnectionStringKey" connectionString="The Connection String"/>
490 </connectionStrings>
492 This allows to take advantage of the connection string encryption as well as manage them using the built in tools.
494 - Added Exists<PkType>(PkType id) support to allow for checking of an object's existance 
495   in the datastore.
497 - Brought ActiveRecordBase.Generic inline with ActiveRecordBase feature wise.  
498   Public Static Methods are now present on all ActiveRecordBase.Generic objects for common tasks such as Find, FindAll, etc.
500   <This is a breaking change.>
501   
502 - Added support for NHibernate dynamic-update, dynamic-insert to ActiveRecordAttribute
504 - Simplified NHibernate markup generation for testing
506   Attributes are now written in one of two ways. Tags that have both an open and close 
507   will have no space at the end of the attributes on the opening tag, while tags that 
508   have no contents (<tag />) will be written with one space after the last attribute.
509   
510   Examples:
511   
512   <openclose attrib="test" attrib2="test"></openclose>
513   
514   <noclosetag attrib="test"/>
516 - Added ActiveRecordValidationBase<> to support validation on Generic AR classes
518 - Updated DeleteAll(Type targetType, IEnumerable pkValues) to support non int primary keys
520 - Add more hookable methods.
522 - Refactored Validation support to use NHibernate.IValidatable
524 - Brought ActiveRecordMediator.Generic inline with ActiveRecordMediator.  This is a breaking 
525   change (removal of a few methods/renaming of a few existing).
527 - Add import support (kudos to Dan Burnea)
528   [ActiveRecord, Import(typeof(ImportClassRow), "ImportClassRow")]
529   public class ImportClass : ActiveRecordBase
531 beta 3
532 ======
534 - Added FindAllByProperty, FindFirst and FindOne
536 - Added DeleteAll(type, where) (kudos to G. Richard Bellamy)
538 - Applied patch from Josh Robb. Added support for hooks on ActiveRecordBase<T>.
540 - DifferentDatabaseScope: so you can open a session using a different dbconnection
541   and persist your object model. Very experimental version
543 - Fixed: Support for multiple databases was completely broken.
545 - An implementation of ISessionFactoryHolder can be specified through the configuration, attribute sessionfactoryholdertype
546   on the config node.
548 - Added: ActiveRecordBase<T> - a generic form a ActiveRecordBase which relieves the need to re-write
549   all the base static methods to hide the type parameter and cast the result. Generics do it for you.
551 - Added: ActiveRecordStarter.CreateSchemaFromFile(filename) as an alternative to CreateSchema. 
553 - Added: Support for composite keys - composite key class must be serializable and implement both Equals and GetHashCode.
554   Not complete support, missing the NHibernate key-many-to-one element in the composite key.
555   
556 - Added: Support for Lazy loading class using BelongsTo. Will throw if there is a non virtual property that
557   also BelongsTo().
559 - Closed: (AR-24) ValidationException must contain the validation error messages
561 - Support for fields in addition to properties
563 - Added [Any], [Any.MetaValue] and [HasManyToAny] attributes.
565 - Small improvement on ActiveRecordModelBuilder (less intensive on IsDefined/GetCustomAttribute)
567 - IThreadScopeInfo introduced. Two implementations: ThreadScopeInfo and WebThreadScopeInfo. 
568   ThreadScopeInfo is the default implementation. You can use WebThreadScopeInfo by simply using 
569   isWeb="true" on the configuration node:
570   
571   <config isWeb="true">
572     ..
573   
574   Or you can provide your own implementation specifying the full type name
576   <config threadinfotype="my.threadinfotype, my.assembly">
577     ..
579 beta 2
580 ======
582 - Transaction support: lots of minor fixes
584 - Added support for map relations. 
585   Necessary to specify Index and IndexType on the HasMany (or HasAndBelongsToMany)
587 - IsUnique validator fix
588   
590 Version 0.0.1.5
591 ===============
592   
593   Inner workings fully rewritten, better test cases coverage
595   Added SlicedFindAll
598 Version 0.0.1.4
599 ===============
601   Implemented support for Joined Subclasses
603   Implemented initial support for validations
606 Version 0.0.1.3
607 ===============
609   Applied patch from John Morales (support for idbags)
612 Version 0.0.1.2
613 ===============
615   Applied patch from John Morales (support for sets)
617   Applied suggestion and fixes from "jianxiao jiang" <jiangjianxiao@gmail.com> (NHibernateDelegate)
620 Version 0.0.1.1
621 ===============
622   
623   Applied patch from Luiz César Kuriki <luizck@gmail.com> in order to support NHibernate's Component feature
624   
625   Applied modification suggested by Andrew Hallock and Craig Neuwirt in order to support HasOne relations.
628 Version 0.0.1.0 
629 ===============
631   Released (not changes to track yet)