User: mzywitza
Date: 2010/01/26 11:38 PM
Added:
/ActiveRecord/trunk/src/Castle.ActiveRecord.Framework.Internal.Tests/Model/
ClassWithExtraLazyOnHasMany.cs
Modified:
/ActiveRecord/trunk/src/
Changes.txt
/ActiveRecord/trunk/src/Castle.ActiveRecord.Framework.Internal.Tests/
Castle.ActiveRecord.Framework.Internal.Tests-vs2008.csproj,
XmlGenerationTestCase.cs
/ActiveRecord/trunk/src/Castle.ActiveRecord/
Castle.ActiveRecord-vs2008.csproj
/ActiveRecord/trunk/src/Castle.ActiveRecord/Attributes/
RelationAttribute.cs
/ActiveRecord/trunk/src/Castle.ActiveRecord/Framework/Internal/Visitors/
XmlGenerationVisitor.cs
Log:
Support for lazy="extra", Patch by Eddie Cianci, AR-ISSUE-279
File Changes:
Directory: /ActiveRecord/trunk/src/Castle.ActiveRecord/Attributes/
==================================================================
File [modified]: RelationAttribute.cs
Delta lines: +1 -0
===================================================================
---
ActiveRecord/trunk/src/Castle.ActiveRecord/Castle.ActiveRecord-vs2008.csproj
2010-01-26 21:28:24 UTC (rev 6718)
+++
ActiveRecord/trunk/src/Castle.ActiveRecord/Castle.ActiveRecord-vs2008.csproj
2010-01-27 06:38:36 UTC (rev 6719)
@@ -387,6 +387,7 @@
<Compile Include="Framework\NHSearchContributor.cs" />
<Compile Include="Framework\Queries\ValueAndTypeTuple.cs" />
<Compile Include="Framework\Scopes\ConversationalScope.cs" />
+ <Compile Include="Framework\Scopes\ConversationCanceledEventArgs.cs" />
<Compile Include="Framework\Scopes\IConversation.cs" />
<Compile Include="Framework\Scopes\IScopeConversation.cs" />
Directory: /ActiveRecord/trunk/src/Castle.ActiveRecord/
=======================================================
File [modified]: Castle.ActiveRecord-vs2008.csproj
Delta lines: +4 -4
===================================================================
---
ActiveRecord/trunk/src/Castle.ActiveRecord/Framework/Internal/Visitors/XmlGenerationVisitor.cs
2010-01-26 21:28:24 UTC (rev 6718)
+++
ActiveRecord/trunk/src/Castle.ActiveRecord/Framework/Internal/Visitors/XmlGenerationVisitor.cs
2010-01-27 06:38:36 UTC (rev 6719)
@@ -496,7 +496,7 @@
Type mapType = GuessType(att.MapType,
model.Property.PropertyType);
WriteCollection(att.Cascade, mapType, att.RelationType,
model.Property.Name,
- model.HasManyToAnyAtt.AccessString,
att.Table, att.Schema, att.Lazy, att.Inverse, att.OrderBy,
+ model.HasManyToAnyAtt.AccessString, att.Table,
att.Schema, att.LazyAttributeValue, att.Inverse, att.OrderBy,
att.Where, att.Sort, att.ColumnKey,
null, null, null, null, null, model.Configuration, att.Index,
att.IndexType,
att.Cache,
att.CacheRegion, att.NotFoundBehaviour, att.Fetch, att.BatchSize,
att.CollectionType);
@@ -662,7 +662,7 @@
Type mapType = GuessType(att.MapType,
model.Property.PropertyType);
WriteCollection(att.Cascade, mapType, att.RelationType,
model.Property.Name,
- model.HasManyAtt.AccessString,
att.Table, att.Schema, att.Lazy, att.Inverse, att.OrderBy,
+ model.HasManyAtt.AccessString, att.Table,
att.Schema, att.LazyAttributeValue, att.Inverse, att.OrderBy,
att.Where, att.Sort, att.ColumnKey,
att.CompositeKeyColumnKeys, att.Element, att.ElementType, null, null,
model.DependentObjectModel, att.Index,
att.IndexType,
att.Cache,
att.CacheRegion, att.NotFoundBehaviour, att.Fetch, att.BatchSize,
att.CollectionType);
@@ -678,7 +678,7 @@
Type mapType = GuessType(att.MapType,
model.Property.PropertyType);
WriteCollection(att.Cascade, mapType, att.RelationType,
model.Property.Name,
- att.AccessString, att.Table,
att.Schema, att.Lazy, att.Inverse, att.OrderBy,
+ att.AccessString, att.Table, att.Schema,
att.LazyAttributeValue, att.Inverse, att.OrderBy,
att.Where, att.Sort, att.ColumnKey,
att.CompositeKeyColumnKeys, att.Element, att.ElementType,
att.ColumnRef,
att.CompositeKeyColumnRefs, model.CollectionID, att.Index, att.IndexType,
att.Cache, att.CacheRegion,
@@ -826,7 +826,7 @@
private void WriteCollection(ManyRelationCascadeEnum
cascadeEnum,
Type targetType, RelationType
type, string name,
- string accessString, string table,
string schema, bool lazy,
+ string accessString, string table,
string schema, string lazy,
bool inverse, string orderBy,
string where, string sort,
string columnKey, string[]
compositeKeyColumnKeys, string element, Type elementType,
Directory: /ActiveRecord/trunk/src/Castle.ActiveRecord.Framework.Internal.Tests/
================================================================================
File [modified]: Castle.ActiveRecord.Framework.Internal.Tests-vs2008.csproj
Delta lines: +30 -0
===================================================================
---
ActiveRecord/trunk/src/Castle.ActiveRecord.Framework.Internal.Tests/Model/ClassWithExtraLazyOnHasMany.cs
(rev 0)
+++
ActiveRecord/trunk/src/Castle.ActiveRecord.Framework.Internal.Tests/Model/ClassWithExtraLazyOnHasMany.cs
2010-01-27 06:38:36 UTC (rev 6719)
@@ -0,0 +1,31 @@
+// Copyright 2004-2009 Castle Project - http://www.castleproject.org/
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+namespace Castle.ActiveRecord.Framework.Internal.Tests.Model
+{
+ using System.Collections.Generic;
+
+ [ActiveRecord]
+ public class ClassWithExtraLazyOnHasMany : ActiveRecordBase
+ {
+ [PrimaryKey]
+ public int Id { get; set; }
+
+ [BelongsTo("Parent_Id")]
+ public ClassWithExtraLazyOnHasMany Parent { get; set; }
+
+ [HasMany(Lazy = true, ExtraLazy = true)]
+ public IList<ClassWithExtraLazyOnHasMany> Children { get; set; }
+ }
File [modified]: XmlGenerationTestCase.cs
Delta lines: +2 -1
===================================================================
--- ActiveRecord/trunk/src/Changes.txt 2010-01-26 21:28:24 UTC (rev 6718)
+++ ActiveRecord/trunk/src/Changes.txt 2010-01-27 06:38:36 UTC (rev 6719)
@@ -15,8 +15,9 @@
assigned for strings
native otherwise
- Added basic support for CpBT (see IConversation interface and tests for
usage)
+- Added support for lazy="extra" by setting Lazy=true and ExtraLazy=true
+ (Patch by Eddie Cianci, AR-ISSUE-279)
-
- Bugs fixed:
AR-ISSUE-157
Directory:
/ActiveRecord/trunk/src/Castle.ActiveRecord.Framework.Internal.Tests/Model/
======================================================================================
File [added]: ClassWithExtraLazyOnHasMany.cs
Delta lines: +33 -0
===================================================================
---
ActiveRecord/trunk/src/Castle.ActiveRecord.Framework.Internal.Tests/XmlGenerationTestCase.cs
2010-01-26 21:28:24 UTC (rev 6718)
+++
ActiveRecord/trunk/src/Castle.ActiveRecord.Framework.Internal.Tests/XmlGenerationTestCase.cs
2010-01-27 06:38:36 UTC (rev 6719)
@@ -1562,5 +1562,38 @@
Assert.AreEqual(expected, xml);
}
+
+ [Test]
+ public void SimpleCaseExtraLazyOnHasMany() {
+ ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder();
+ ActiveRecordModel model =
builder.Create(typeof(ClassWithExtraLazyOnHasMany));
+ Assert.IsNotNull(model);
+
+ SemanticVerifierVisitor semanticVisitor = new
SemanticVerifierVisitor(builder.Models);
+ semanticVisitor.VisitNode(model);
+
+ XmlGenerationVisitor xmlVisitor = new XmlGenerationVisitor();
+ xmlVisitor.CreateXml(model);
+
+ String xml = xmlVisitor.Xml;
+
+ const string expected =
+ "<?xml version=\"1.0\"
encoding=\"utf-16\"?>\r\n" +
+ "<hibernate-mapping auto-import=\"true\"
default-lazy=\"false\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns=\"urn:nhibernate-mapping-2.2\">\r\n" +
+ " <class
name=\"Castle.ActiveRecord.Framework.Internal.Tests.Model.ClassWithExtraLazyOnHasMany,
Castle.ActiveRecord.Framework.Internal.Tests\"
table=\"ClassWithExtraLazyOnHasMany\">\r\n" +
+ " <id name=\"Id\" access=\"property\" column=\"Id\"
type=\"Int32\" unsaved-value=\"0\">\r\n" +
+ " <generator class=\"native\">\r\n" +
+ " </generator>\r\n" +
+ " </id>\r\n" +
+ " <many-to-one name=\"Parent\" access=\"property\"
class=\"Castle.ActiveRecord.Framework.Internal.Tests.Model.ClassWithExtraLazyOnHasMany,
Castle.ActiveRecord.Framework.Internal.Tests\" column=\"Parent_Id\"
lazy=\"proxy\" />\r\n" +
+ " <bag name=\"Children\" access=\"property\"
table=\"ClassWithExtraLazyOnHasMany\" lazy=\"extra\">\r\n" +
+ " <key column=\"Parent_Id\" />\r\n" +
+ " <one-to-many
class=\"Castle.ActiveRecord.Framework.Internal.Tests.Model.ClassWithExtraLazyOnHasMany,
Castle.ActiveRecord.Framework.Internal.Tests\" />\r\n" +
+ " </bag>\r\n" +
+ " </class>\r\n" +
+ "</hibernate-mapping>\r\n";
+
+ Assert.AreEqual(expected, xml);
+ }
}
Directory:
/ActiveRecord/trunk/src/Castle.ActiveRecord/Framework/Internal/Visitors/
===================================================================================
File [modified]: XmlGenerationVisitor.cs
Delta lines: +1 -0
===================================================================
---
ActiveRecord/trunk/src/Castle.ActiveRecord.Framework.Internal.Tests/Castle.ActiveRecord.Framework.Internal.Tests-vs2008.csproj
2010-01-26 21:28:24 UTC (rev 6718)
+++
ActiveRecord/trunk/src/Castle.ActiveRecord.Framework.Internal.Tests/Castle.ActiveRecord.Framework.Internal.Tests-vs2008.csproj
2010-01-27 06:38:36 UTC (rev 6719)
@@ -185,6 +185,7 @@
</Compile>
<Compile Include="Model\CompositeKeyForClassWithCompositeKey.cs" />
<Compile Include="Model\ClassADynamicInsertUpdate.cs" />
+ <Compile Include="Model\ClassWithExtraLazyOnHasMany.cs" />
<Compile Include="Model\HasManyToAnyWithBadList.cs" />
<Compile Include="Model\HasAndBelongsToManyWithBadList.cs" />
Directory: /ActiveRecord/trunk/src/
===================================
File [modified]: Changes.txt
Delta lines: +0 -0
===================================================================
--
You received this message because you are subscribed to the Google Groups
"Castle Project Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-commits?hl=en.