• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ActiveRecordModelBuilder类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ActiveRecordModelBuilder的典型用法代码示例。如果您正苦于以下问题:C# ActiveRecordModelBuilder类的具体用法?C# ActiveRecordModelBuilder怎么用?C# ActiveRecordModelBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ActiveRecordModelBuilder类属于命名空间,在下文中一共展示了ActiveRecordModelBuilder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AnyAttribute

        public void AnyAttribute()
        {
            ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder();
            ActiveRecordModel model = builder.Create(typeof(ClassWithAnyAttribute));
            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.ClassWithAnyAttribute, Castle.ActiveRecord.Framework.Internal.Tests\" table=\"ClassWithAnyAttribute\">\r\n" +
                "    <id name=\"Id\" access=\"nosetter.camelcase-underscore\" column=\"Id\" type=\"Int32\" unsaved-value=\"0\">\r\n" +
                "      <generator class=\"native\">\r\n" +
                "      </generator>\r\n" +
                "    </id>\r\n" +
                "    <any name=\"PaymentMethod\" access=\"property\" id-type=\"Int64\" meta-type=\"System.String\" cascade=\"save-update\" not-null=\"true\">\r\n" +
                "      <meta-value value=\"BANK_ACCOUNT\" class=\"Castle.ActiveRecord.Framework.Internal.Tests.Model.BankAccount, Castle.ActiveRecord.Framework.Internal.Tests\" />\r\n" +
                "      <column name=\"BILLING_DETAILS_TYPE\" />\r\n" +
                "      <column name=\"BILLING_DETAILS_ID\" />\r\n" +
                "    </any>\r\n" +
                "  </class>\r\n" +
                "</hibernate-mapping>\r\n";

            Assert.AreEqual(expected, xml);
        }
开发者ID:zhoufoxcn,项目名称:ActiveRecord,代码行数:32,代码来源:XmlGenerationTestCase.cs


示例2: ImportsGeneration

        public void ImportsGeneration()
        {
            ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder();
            ActiveRecordModel model = builder.Create(typeof(ImportClass));
            Assert.IsNotNull(model);

            string xml = Process(builder, model);

            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" +
                    "  <import class=\"Castle.ActiveRecord.Framework.Internal.Tests.ImportClassRow, Castle.ActiveRecord.Framework.Internal.Tests\" rename=\"ImportClassRow\" />\r\n" +
                    "  <class name=\"Castle.ActiveRecord.Framework.Internal.Tests.Model.ImportClass, Castle.ActiveRecord.Framework.Internal.Tests\" table=\"ImportClass\" lazy=\"false\">\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" +
                    "    <property name=\"Name\" access=\"property\" type=\"String\">\r\n" +
                    "      <column name=\"Name\" />\r\n" +
                    "    </property>\r\n" +
                    "  </class>\r\n" +
                    "</hibernate-mapping>\r\n";

            Assert.AreEqual(expected, xml);
        }
开发者ID:zhoufoxcn,项目名称:ActiveRecord,代码行数:25,代码来源:ImportTestCase.cs


示例3: SimpleCaseWithNestedComponent

		public void SimpleCaseWithNestedComponent()
		{
			ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder();
			ActiveRecordModel model = builder.Create(typeof(SimpleNestedComponent));
			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.SimpleNestedComponent, Castle.ActiveRecord.Framework.Internal.Tests\" table=\"SimpleNestedComponent\">\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" +
				"    <component name=\"Nested\" class=\"Castle.ActiveRecord.Framework.Internal.Tests.Model.NestedComponent, Castle.ActiveRecord.Framework.Internal.Tests\" access=\"property\">\r\n" +
				"      <parent name=\"Parent\"/>\r\n" +
				"      <property name=\"NestedProperty\" access=\"property\" type=\"String\">\r\n" +
				"        <column name=\"NestedProperty\"/>\r\n" +
				"      </property>\r\n" +
				"    </component>\r\n" +
				"  </class>\r\n" +
				"</hibernate-mapping>\r\n";

			Assert.AreEqual(expected, xml);
		}
开发者ID:ralescano,项目名称:castle,代码行数:33,代码来源:XmlGenerationTestCase.cs


示例4: UsingAnyWithoutSpecifyingTheMetaType

		public void UsingAnyWithoutSpecifyingTheMetaType()
		{
			ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder();
			ActiveRecordModel model = builder.Create(typeof(BadClassWithAnyAttribute));
			Assert.IsNotNull(model);

			Assert.IsNotNull(model);

			SemanticVerifierVisitor semanticVisitor = new SemanticVerifierVisitor(builder.Models);
			semanticVisitor.VisitNode(model);
		}
开发者ID:sheefa,项目名称:Castle.ActiveRecord,代码行数:11,代码来源:SemanticCheckTestCase.cs


示例5: Process

        private string Process(ActiveRecordModelBuilder builder, ActiveRecordModel model)
        {
            GraphConnectorVisitor connectorVisitor = new
                GraphConnectorVisitor(builder.Models);
            connectorVisitor.VisitNode(model);

            SemanticVerifierVisitor semanticVisitor = new
                SemanticVerifierVisitor(builder.Models);
            semanticVisitor.VisitNode(model);

            XmlGenerationVisitor xmlVisitor = new XmlGenerationVisitor();
            xmlVisitor.CreateXml(model);

            return xmlVisitor.Xml;
        }
开发者ID:zhoufoxcn,项目名称:ActiveRecord,代码行数:15,代码来源:ImportTestCase.cs


示例6: SimpleClassWithGuessedEnumElementList

		public void SimpleClassWithGuessedEnumElementList()
		{
			ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder();
			ActiveRecordModel model = builder.Create(typeof(EnumModel));
			Assert.IsNotNull(model);

			String xml = Process(builder, model);
			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.EnumModel, Castle.ActiveRecord.Framework.Internal.Tests\" table=\"EnumModel\">\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" +
									"    <bag name=\"Roles\" access=\"property\" table=\"Roles\" lazy=\"false\">\r\n" +
									"      <key column=\"EnumModelId\" />\r\n" +
									"      <element  column=\"RoleId\"  type=\"Castle.ActiveRecord.Framework.Internal.Tests.Model.Role, Castle.ActiveRecord.Framework.Internal.Tests\"/>\r\n" +
									"    </bag>\r\n" +
									"  </class>\r\n" +
									"</hibernate-mapping>\r\n";

			Assert.AreEqual(expected, xml);
		}
开发者ID:ralescano,项目名称:castle,代码行数:23,代码来源:XmlGenerationTestCase.cs


示例7: CompositeClassWithBelongsTo

		public void CompositeClassWithBelongsTo()
		{
			ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder();
			ActiveRecordModel model = builder.Create(typeof(ClassWithCompositeKey3));
			Assert.IsNotNull(model);

			String xml = Process(builder, model);
			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.ClassWithCompositeKey3, Castle.ActiveRecord.Framework.Internal.Tests\" table=\"ClassWithCompositeKey3\" lazy=\"false\">\r\n" +
									"    <composite-id name=\"Key\" class=\"Castle.ActiveRecord.Framework.Internal.Tests.Model.CompositeKey2, Castle.ActiveRecord.Framework.Internal.Tests\" unsaved-value=\"none\" access=\"property\">\r\n" +
									"      <key-property name=\"Key1\" access=\"property\" column=\"Key1\" type=\"Int32\" />\r\n" +
									"      <key-many-to-one name=\"Key2\" access=\"property\" column=\"Key2\" type=\"String\" />\r\n" +
									"    </composite-id>\r\n" +
									"  </class>\r\n" +
									"</hibernate-mapping>\r\n";

			Assert.AreEqual(expected, xml);
		}
开发者ID:ralescano,项目名称:castle,代码行数:19,代码来源:XmlGenerationTestCase.cs


示例8: SimpleClassWithMappedFieldAndNonDefaultAccess

		public void SimpleClassWithMappedFieldAndNonDefaultAccess()
		{
			ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder();
			ActiveRecordModel model = builder.Create(typeof(ClassWithMappedField));
			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.ClassWithMappedField, Castle.ActiveRecord.Framework.Internal.Tests\" table=\"ClassWithMappedField\">\r\n" +
									"    <id name=\"Id\" access=\"nosetter.camelcase-underscore\" column=\"Id\" type=\"Int32\" unsaved-value=\"0\">\r\n" +
									"      <generator class=\"native\">\r\n" +
									"      </generator>\r\n" +
									"    </id>\r\n" +
									"    <property name=\"name1\" access=\"field\" type=\"String\">\r\n" +
									"      <column name=\"MyCustomName\"/>\r\n" +
									"    </property>\r\n" +
									"    <property name=\"Value\" access=\"CustomAccess\" type=\"Int32\">\r\n" +
									"      <column name=\"Value\"/>\r\n" +
									"    </property>\r\n" +
									"  </class>\r\n" +
									"</hibernate-mapping>\r\n";

			Assert.AreEqual(expected, xml);
		}
开发者ID:ralescano,项目名称:castle,代码行数:32,代码来源:XmlGenerationTestCase.cs


示例9: HasManyToAnyAttribute

		public void HasManyToAnyAttribute()
		{
			ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder();
			ActiveRecordModel model = builder.Create(typeof(ClasssWithHasManyToAny));
			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.ClasssWithHasManyToAny, Castle.ActiveRecord.Framework.Internal.Tests\" table=\"ClasssWithHasManyToAny\">\r\n" +
				"    <id name=\"Id\" access=\"nosetter.camelcase-underscore\" column=\"Id\" type=\"Int32\" unsaved-value=\"0\">\r\n" +
				"      <generator class=\"native\">\r\n" +
				"      </generator>\r\n" +
				"    </id>\r\n" +
				"    <set name=\"PaymentMethod\" access=\"property\" table=\"payments_table\" lazy=\"false\">\r\n" +
				"      <key column=\"pay_id\" />\r\n" +
				"      <many-to-any id-type=\"Int32\" meta-type=\"Int32\">\r\n" +
				"        <column name=\"payment_type\" />\r\n" +
				"        <column name=\"payment_method_id\" />\r\n" +
				"      </many-to-any>\r\n" +
				"    </set>\r\n" +
				"  </class>\r\n" +
				"</hibernate-mapping>\r\n";

			Assert.AreEqual(expected, xml);
		}
开发者ID:ralescano,项目名称:castle,代码行数:33,代码来源:XmlGenerationTestCase.cs


示例10: HasManyWithBatch

		public void HasManyWithBatch()
		{
			ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder();
			ActiveRecordModel model = builder.Create(typeof(HasManyWithBatch));
			Assert.IsNotNull(model);

			String xml = Process(builder, model);

			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.HasManyWithBatch, Castle.ActiveRecord.Framework.Internal.Tests\" table=\"HasManyWithBatch\" lazy=\"false\">\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" +
				"    <bag name=\"Items\" access=\"property\" table=\"ClassATable\" lazy=\"false\" inverse=\"true\" batch-size=\"3\">\r\n" +
				"      <key column=\"keycol\" />\r\n" +
				"      <one-to-many class=\"Castle.ActiveRecord.Framework.Internal.Tests.Model.ClassA, Castle.ActiveRecord.Framework.Internal.Tests\" />\r\n" +
				"    </bag>\r\n" +
				"  </class>\r\n" +
				"</hibernate-mapping>\r\n";

			Assert.AreEqual(expected, xml);
		}
开发者ID:ralescano,项目名称:castle,代码行数:25,代码来源:XmlGenerationTestCase.cs


示例11: JoinedSubClassUseWithGenericTypeAndGenericAbstractBase

		public void JoinedSubClassUseWithGenericTypeAndGenericAbstractBase()
		{
			ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder();
			builder.Create(typeof(GenSubClassJoinedClass));
			ActiveRecordModel model = builder.Create(typeof(GenBaseJoinedClass<GenSubClassJoinedClass>));
			Assert.IsNotNull(model);

			String xml = Process(builder, model);

			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.GenBaseJoinedClass`1[[Castle.ActiveRecord.Framework.Internal.Tests.Model.GenSubClassJoinedClass, Castle.ActiveRecord.Framework.Internal.Tests, Version=1.0.3.0, Culture=neutral, PublicKeyToken=null]], Castle.ActiveRecord.Framework.Internal.Tests\" table=\"disctable\">\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" +
				"    <property name=\"Name\" access=\"property\" type=\"String\">\r\n" +
				"      <column name=\"Name\"/>\r\n" +
				"    </property>\r\n" +
				"    <joined-subclass name=\"Castle.ActiveRecord.Framework.Internal.Tests.Model.GenSubClassJoinedClass, Castle.ActiveRecord.Framework.Internal.Tests\" table=\"disctablea\" lazy=\"false\">\r\n" +
				"      <key column=\"AId\" />\r\n" +
				"      <property name=\"Age\" access=\"property\" type=\"Int32\">\r\n" +
				"        <column name=\"Age\"/>\r\n" +
				"      </property>\r\n" +
				"    </joined-subclass>\r\n" +
				"  </class>\r\n" +
				"</hibernate-mapping>\r\n";

			Assert.AreEqual(expected, xml);
		}
开发者ID:ralescano,项目名称:castle,代码行数:31,代码来源:XmlGenerationTestCase.cs


示例12: ManyToMayViaComponents

		public void ManyToMayViaComponents()
		{
			ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder();
			ActiveRecordModel model = builder.Create(typeof(HasManyToManyViaComponents));
			Assert.IsNotNull(model);

			String xml = Process(builder, model);
			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.HasManyToManyViaComponents, Castle.ActiveRecord.Framework.Internal.Tests\" table=\"HasManyToManyViaComponents\">\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" +
				"    <list name=\"Components\" access=\"property\" table=\"components_to_a\" lazy=\"false\">\r\n" +
				"      <key column=\"id\" />\r\n" +
				"      <index column=\"pos\" />\r\n" +
				"      <composite-element class=\"Castle.ActiveRecord.Framework.Internal.Tests.ComponentManyToClassA, Castle.ActiveRecord.Framework.Internal.Tests\">\r\n" +
				"        <property name=\"Value\" access=\"property\" type=\"String\">\r\n" +
				"          <column name=\"Value\"/>\r\n" +
				"        </property>\r\n" +
				"        <many-to-one name=\"A\" access=\"property\" class=\"Castle.ActiveRecord.Framework.Internal.Tests.Model.ClassA, Castle.ActiveRecord.Framework.Internal.Tests\" column=\"aId\" />\r\n" +
				"      </composite-element>\r\n" +
				"    </list>\r\n" +
				"  </class>\r\n" +
				"</hibernate-mapping>\r\n";
			Assert.AreEqual(expected, xml);
		}
开发者ID:ralescano,项目名称:castle,代码行数:29,代码来源:XmlGenerationTestCase.cs


示例13: HasManyWithDictionary

		public void HasManyWithDictionary()
		{
			ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder();
			ActiveRecordModel model = builder.Create(typeof(DictionaryModel));
			Assert.IsNotNull(model);

			string xml = Process(builder, model);

			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.DictionaryModel, Castle.ActiveRecord.Framework.Internal.Tests\" table=\"DictionaryModel\">\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" +
				"    <map name=\"Snippet\" access=\"property\" table=\"DictionaryModel_Snippet\" lazy=\"false\">\r\n" +
				"      <key column=\"id\" />\r\n" +
				"      <index column=\"LangCode\" type=\"String\" />\r\n" +
				"      <element  column=\"Text\"  type=\"System.String, mscorlib\"/>\r\n" +
				"    </map>\r\n" +
				"  </class>\r\n" +
				"</hibernate-mapping>\r\n";

			Assert.AreEqual(expected, xml);
		}
开发者ID:ralescano,项目名称:castle,代码行数:26,代码来源:XmlGenerationTestCase.cs


示例14: NotFoundBehaviourClass

		public void NotFoundBehaviourClass()
		{
			ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder();
			ActiveRecordModel NotFoundBehaviourClassModel = builder.Create(typeof(NotFoundBehaviourClass));
			ActiveRecordModel RelationalFoobarModel = builder.Create(typeof(RelationalFoobar));
			Assert.IsNotNull(NotFoundBehaviourClassModel);
			Assert.IsNotNull(RelationalFoobarModel);

			String xml = Process(builder, NotFoundBehaviourClassModel);

			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.NotFoundBehaviourClass, Castle.ActiveRecord.Framework.Internal.Tests\" table=\"NotFoundBehaviourClass\">\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" +
				"    <bag name=\"SubClasses\" access=\"property\" table=\"RelationalFoobarTable\" lazy=\"false\">\r\n" +
				"      <key column=\"keycol\" />\r\n" +
				"      <one-to-many class=\"Castle.ActiveRecord.Framework.Internal.Tests.Model.RelationalFoobar, Castle.ActiveRecord.Framework.Internal.Tests\" not-found=\"ignore\" />\r\n" +
				"    </bag>\r\n" +
				"    <bag name=\"ManySubClasses\" access=\"property\" table=\"ManySubClasses\" lazy=\"false\">\r\n" +
				"      <key column=\"id\" />\r\n" +
				"      <many-to-many class=\"Castle.ActiveRecord.Framework.Internal.Tests.Model.RelationalFoobar, Castle.ActiveRecord.Framework.Internal.Tests\" column=\"ref_id\" not-found=\"ignore\"/>\r\n" +
				"    </bag>\r\n" +
				"  </class>\r\n" +
				"</hibernate-mapping>\r\n";

			Assert.AreEqual(expected, xml);

			xml = Process(builder, RelationalFoobarModel);

			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.RelationalFoobar, Castle.ActiveRecord.Framework.Internal.Tests\" table=\"RelationalFoobar\">\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=\"NotFoundBehaviourClass\" access=\"property\" class=\"Castle.ActiveRecord.Framework.Internal.Tests.Model.NotFoundBehaviourClass, Castle.ActiveRecord.Framework.Internal.Tests\" column=\"NotFoundBehaviourClass\" not-found=\"ignore\" />\r\n" +
				"    <bag name=\"NotFoundBehaviourClassList\" access=\"property\" table=\"ManySubClasses\" lazy=\"false\">\r\n" +
				"      <key column=\"id\" />\r\n" +
				"      <many-to-many class=\"Castle.ActiveRecord.Framework.Internal.Tests.Model.NotFoundBehaviourClass, Castle.ActiveRecord.Framework.Internal.Tests\" column=\"ref_id\" not-found=\"ignore\"/>\r\n" +
				"    </bag>\r\n" +
				"  </class>\r\n" +
				"</hibernate-mapping>\r\n";

			Assert.AreEqual(expected, xml);
		}
开发者ID:ralescano,项目名称:castle,代码行数:51,代码来源:XmlGenerationTestCase.cs


示例15: One2OneKey

		public void One2OneKey()
		{
			ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder();
			ActiveRecordModel empModel = builder.Create(typeof(Employee));
			ActiveRecordModel awardModel = builder.Create(typeof(Award));
			Assert.IsNotNull(empModel);
			Assert.IsNotNull(awardModel);

			string xml = Process(builder, empModel);

			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.Employee, Castle.ActiveRecord.Framework.Internal.Tests\" table=\"Employee\" lazy=\"false\">\r\n" +
				"    <id name=\"ID\" access=\"property\" column=\"EmployeeID\" type=\"Int32\" unsaved-value=\"0\">\r\n" +
				"      <generator class=\"native\">\r\n" +
				"      </generator>\r\n" +
				"    </id>\r\n" +
				"    <property name=\"FirstName\" access=\"property\" type=\"String\">\r\n" +
				"      <column name=\"FirstName\"/>\r\n" +
				"    </property>\r\n" +
				"    <property name=\"LastName\" access=\"property\" type=\"String\">\r\n" +
				"      <column name=\"LastName\"/>\r\n" +
				"    </property>\r\n" +
				"    <one-to-one name=\"Award\" access=\"property\" class=\"Castle.ActiveRecord.Framework.Internal.Tests.Model.Award, Castle.ActiveRecord.Framework.Internal.Tests\" foreign-key=\"FK_FOREIGN_KEY\" fetch=\"join\" constrained=\"true\" />\r\n" +
				"  </class>\r\n" +
				"</hibernate-mapping>\r\n";

			Assert.AreEqual(expected, xml);

			xml = Process(builder, awardModel);

			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.Award, Castle.ActiveRecord.Framework.Internal.Tests\" table=\"Award\" lazy=\"false\">\r\n" +
				"    <id name=\"ID\" access=\"property\" column=\"EmployeeID\" type=\"Int32\" unsaved-value=\"0\">\r\n" +
				"      <generator class=\"foreign\">\r\n" +
				"        <param name=\"property\">Employee</param>\r\n" +
				"      </generator>\r\n" +
				"    </id>\r\n" +
				"    <property name=\"Description\" access=\"property\" type=\"String\">\r\n" +
				"      <column name=\"Description\"/>\r\n" +
				"    </property>\r\n" +
				"    <one-to-one name=\"Employee\" access=\"property\" class=\"Castle.ActiveRecord.Framework.Internal.Tests.Model.Employee, Castle.ActiveRecord.Framework.Internal.Tests\" />\r\n" +
				"  </class>\r\n" +
				"</hibernate-mapping>\r\n";

			Assert.AreEqual(expected, xml);
		}
开发者ID:ralescano,项目名称:castle,代码行数:50,代码来源:XmlGenerationTestCase.cs


示例16: DiscriminatorLengthUse

		public void DiscriminatorLengthUse()
		{
			ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder();
			builder.Create(typeof(ClassDiscriminatorB));
			ActiveRecordModel model = builder.Create(typeof(ClassDiscriminatorLengthParent));
			Assert.IsNotNull(model);

			String xml = Process(builder, model);

			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.ClassDiscriminatorLengthParent, Castle.ActiveRecord.Framework.Internal.Tests\" table=\"disctable\" discriminator-value=\"parent\">\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" +
				"    <discriminator column=\"type\" type=\"String\" length=\"10\" />\r\n" +
				"    <property name=\"Name\" access=\"property\" type=\"String\">\r\n" +
				"      <column name=\"Name\"/>\r\n" +
				"    </property>\r\n" +
				"    <subclass name=\"Castle.ActiveRecord.Framework.Internal.Tests.Model.ClassDiscriminatorB, Castle.ActiveRecord.Framework.Internal.Tests\" discriminator-value=\"B\">\r\n" +
				"      <property name=\"Age\" access=\"property\" type=\"Int32\">\r\n" +
				"        <column name=\"Age\"/>\r\n" +
				"      </property>\r\n" +
				"    </subclass>\r\n" +
				"  </class>\r\n" +
				"</hibernate-mapping>\r\n";

			Assert.AreEqual(expected, xml);
		}
开发者ID:ralescano,项目名称:castle,代码行数:31,代码来源:XmlGenerationTestCase.cs


示例17: IdBagPrimitive

		public void IdBagPrimitive()
		{
			ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder();
			ActiveRecordModel model = builder.Create(typeof(IdBagPrimitive));
			Assert.IsNotNull(model);

			String xml = Process(builder, model);
			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.IdBagPrimitive, Castle.ActiveRecord.Framework.Internal.Tests\" table=\"IdBagPrimitive\">\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" +
				"    <idbag name=\"Items\" access=\"property\" table=\"IdToItems\" lazy=\"false\">\r\n" +
				"      <collection-id type=\"Int32\" column=\"col\">\r\n" +
				"        <generator class=\"sequence\">\r\n" + 
				"        </generator>\r\n" +
				"      </collection-id>\r\n" +
				"      <key column=\"keyid\" />\r\n" +
				"      <element  type=\"System.String\" />\r\n" + 
				"    </idbag>\r\n" + 
				"  </class>\r\n" +
				"</hibernate-mapping>\r\n";
			Assert.AreEqual(expected, xml);
		}
开发者ID:ralescano,项目名称:castle,代码行数:27,代码来源:XmlGenerationTestCase.cs


示例18: SimpleCaseWithBatch_SelectBeforeUpdate_Locking_Polimorphism

		public void SimpleCaseWithBatch_SelectBeforeUpdate_Locking_Polimorphism()
		{
			ActiveRecordModelBuilder builder = new ActiveRecordModelBuilder();
			ActiveRecordModel model = builder.Create(typeof(ClassWithSomeCustomOptions));
			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.ClassWithSomeCustomOptions, Castle.ActiveRecord.Framework.Internal.Tests\" table=\"ClassA\" select-before-update=\"true\" polymorphism=\"explicit\" batch-size=\"10\" optimistic-lock=\"dirty\">\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" +
				"    <property name=\"Name1\" access=\"property\" type=\"String\" insert=\"false\" update=\"false\">\r\n" +
				"      <column name=\"Name1\"/>\r\n" +
				"    </property>\r\n" +
				"  </class>\r\n" +
				"</hibernate-mapping>\r\n";

			Assert.AreEqual(expected, xml);
		}
开发者ID:ralescano,项目名称:castle,代码行数:30,代码来源:XmlGenerationTestCase.cs


示例19: BelongsTo2


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ActiveRegion类代码示例发布时间:2022-05-24
下一篇:
C# ActiveDirectorySecurityInheritance类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap