当前位置: 首页>>代码示例>>C#>>正文


C# IClassDef.CreateNewBusinessObject方法代码示例

本文整理汇总了C#中IClassDef.CreateNewBusinessObject方法的典型用法代码示例。如果您正苦于以下问题:C# IClassDef.CreateNewBusinessObject方法的具体用法?C# IClassDef.CreateNewBusinessObject怎么用?C# IClassDef.CreateNewBusinessObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IClassDef的用法示例。


在下文中一共展示了IClassDef.CreateNewBusinessObject方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test_GetPropertyValueToDisplay_WhenVirtualPropertyValue

        public void Test_GetPropertyValueToDisplay_WhenVirtualPropertyValue()
		{
			ClassDef.ClassDefs.Clear();
			_itsClassDef = MyBO.LoadDefaultClassDef();
			MyBO bo1 = (MyBO)_itsClassDef.CreateNewBusinessObject();

			BOMapper mapper = new BOMapper(bo1);
			Assert.AreEqual("MyNameIsMyBo", mapper.GetPropertyValueToDisplay("-MyName-"));
		}
开发者ID:kevinbosman,项目名称:habanero,代码行数:9,代码来源:TestBoMapper.cs

示例2: Test_GetPropertyValue_WithDot

		public void Test_GetPropertyValue_WithDot()
		{
			ClassDef.ClassDefs.Clear();
			_itsClassDef = MyBO.LoadClassDefWithRelationship();
			_itsRelatedClassDef = MyRelatedBo.LoadClassDef();
			//MyBO bo1 = (MyBO)itsClassDef.CreateNewBusinessObject(connection);
			MyBO bo1 = (MyBO)_itsClassDef.CreateNewBusinessObject();
			MyRelatedBo relatedBo = (MyRelatedBo)_itsRelatedClassDef.CreateNewBusinessObject();
			Guid myRelatedBoGuid = relatedBo.ID.GetAsGuid();
			bo1.SetPropertyValue("RelatedID", myRelatedBoGuid);
			relatedBo.SetPropertyValue("MyRelatedTestProp", "MyValue");
			BOMapper mapper = new BOMapper(bo1);

			Assert.AreEqual("MyValue", mapper.GetPropertyValueToDisplay("MyRelationship.MyRelatedTestProp"));
		}
开发者ID:kevinbosman,项目名称:habanero,代码行数:15,代码来源:TestBoMapper.cs

示例3: Test_GetPropertyValue_WithDot_IncorrectRelationshipName

		public void Test_GetPropertyValue_WithDot_IncorrectRelationshipName()
		{
			//---------------Set up test pack-------------------
			ClassDef.ClassDefs.Clear();
			_itsClassDef = MyBO.LoadClassDefWithRelationship();
			_itsRelatedClassDef = MyRelatedBo.LoadClassDef();
			MyBO bo1 = (MyBO) _itsClassDef.CreateNewBusinessObject();
			BOMapper mapper = new BOMapper(bo1);
			//---------------Execute Test ----------------------
			try
			{
				mapper.GetPropertyValueToDisplay("MyIncorrectRelationship.MyRelatedTestProp");
				Assert.Fail("Expected to throw an RelationshipNotFoundException");
			}
				//---------------Test Result -----------------------
			catch (RelationshipNotFoundException ex)
			{
				StringAssert.Contains("The relationship 'MyIncorrectRelationship' on 'MyBO' cannot be found", ex.Message);
			}
		}
开发者ID:kevinbosman,项目名称:habanero,代码行数:20,代码来源:TestBoMapper.cs

示例4: Test_SetDisplayPropertyValue_WhenLookupList_ShouldSetUnderlyingValue

		public void Test_SetDisplayPropertyValue_WhenLookupList_ShouldSetUnderlyingValue()
		{
			//---------------Set up test pack-------------------
			ClassDef.ClassDefs.Clear();
			const string propertyName = "TestProp2";
			const string expectedLookupDisplayValue = "s1";
			Guid expectedLookupValue;
			StringUtilities.GuidTryParse("{E6E8DC44-59EA-4e24-8D53-4A43DC2F25E7}", out expectedLookupValue);
			_itsClassDef = MyBO.LoadClassDefWithLookup();
			MyBO bo1 = (MyBO)_itsClassDef.CreateNewBusinessObject();
			BOMapper boMapper = new BOMapper(bo1);
			//---------------Assert Precondition----------------
			Assert.IsNullOrEmpty(bo1.TestProp2);
			//---------------Execute Test ----------------------
			boMapper.SetDisplayPropertyValue(propertyName, expectedLookupDisplayValue);
			//---------------Test Result -----------------------
			Assert.AreEqual(expectedLookupValue, bo1.GetPropertyValue(propertyName));
			Assert.AreEqual(expectedLookupDisplayValue, bo1.GetPropertyValueToDisplay(propertyName));
		}
开发者ID:kevinbosman,项目名称:habanero,代码行数:19,代码来源:TestBoMapper.cs

示例5: Test_GetPropertyValueToDisplay_SimpleLookup

		public void Test_GetPropertyValueToDisplay_SimpleLookup()
		{
			ClassDef.ClassDefs.Clear();
			_itsClassDef = MyBO.LoadClassDefWithSimpleIntegerLookup();
			MyBO bo1 = (MyBO)_itsClassDef.CreateNewBusinessObject();
			bo1.SetPropertyValue("TestProp2", "Text");
			BOMapper mapper = new BOMapper(bo1);
			Assert.AreEqual("Text", mapper.GetPropertyValueToDisplay("TestProp2"));
		}
开发者ID:kevinbosman,项目名称:habanero,代码行数:9,代码来源:TestBoMapper.cs

示例6: GetCol_BO_2Items

 private static IBusinessObjectCollection GetCol_BO_2Items(IClassDef classDef)
 {
     IBusinessObjectCollection col = new BusinessObjectCollection<BusinessObject>(classDef);
     IBusinessObject bo1 = classDef.CreateNewBusinessObject();
     bo1.SetPropertyValue("TestProp", "Value1");
     bo1.SetPropertyValue("TestProp2", "Value2");
     IBusinessObject bo2 = classDef.CreateNewBusinessObject();
     bo2.SetPropertyValue("TestProp", "2Value1");
     bo2.SetPropertyValue("TestProp2", "2Value2");
     col.Add(bo1);
     col.Add(bo2);
     return col;
 }
开发者ID:Chillisoft,项目名称:habanero.faces,代码行数:13,代码来源:TestEditableGrid.cs

示例7: GetCol_BO_1CheckboxItem

 private static IBusinessObjectCollection GetCol_BO_1CheckboxItem(IClassDef classDef)
 {
     IBusinessObjectCollection col = new BusinessObjectCollection<BusinessObject>(classDef);
     IBusinessObject bo1 = classDef.CreateNewBusinessObject();
     bo1.SetPropertyValue("TestProp", true);
     col.Add(bo1);
     return col;
 }
开发者ID:Chillisoft,项目名称:habanero.faces,代码行数:8,代码来源:TestEditableGrid.cs

示例8: GetCol_BO_1ComboBoxItem

 private static IBusinessObjectCollection GetCol_BO_1ComboBoxItem(IClassDef classDef)
 {
     IBusinessObjectCollection col = new BusinessObjectCollection<BusinessObject>(classDef);
     IBusinessObject bo1 = classDef.CreateNewBusinessObject();
     bo1.SetPropertyValue("RelatedID", Guid.NewGuid());
     col.Add(bo1);
     return col;
 }
开发者ID:Chillisoft,项目名称:habanero.faces,代码行数:8,代码来源:TestEditableGrid.cs

示例9: TestCreateBusinessObject_SetsDefaults

        public void TestCreateBusinessObject_SetsDefaults()
        {
            //---------------Set up test pack-------------------
            ClassDef.ClassDefs.Clear();
            XmlClassLoader loader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            _classDef =
                loader.LoadClass(
                    @"
				<class name=""MyBO"" assembly=""Habanero.Test"">
					<property  name=""MyBoID"" type=""Guid"" />
					<property  name=""TestProp"" default=""defaultValue"" />
					<primaryKey>
						<prop name=""MyBoID"" />
					</primaryKey>
				</class>
			");
            ClassDef.ClassDefs.Add(_classDef);
            //-------------Assert Preconditions -------------

            //---------------Execute Test ----------------------
            IBusinessObject bo = _classDef.CreateNewBusinessObject();
            //---------------Test Result -----------------------
            Assert.IsInstanceOf(typeof(MyBO), bo);
            Assert.AreEqual("defaultValue", bo.GetPropertyValue("TestProp"));
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:25,代码来源:TestClassDef.cs

示例10: TestCreateBusinessObject

        public void TestCreateBusinessObject()
        {
            ClassDef.ClassDefs.Clear();
            XmlClassLoader loader = new XmlClassLoader(new DtdLoader(), new DefClassFactory());
            _classDef =
                loader.LoadClass(
                    @"
				<class name=""MyBO"" assembly=""Habanero.Test"">
					<property  name=""MyBoID"" type=""Guid"" />
					<property  name=""TestProp"" />
					<primaryKey>
						<prop name=""MyBoID"" />
					</primaryKey>
				</class>
			");
            ClassDef.ClassDefs.Add(_classDef);
            IBusinessObject bo = _classDef.CreateNewBusinessObject();
            Assert.AreSame(typeof(MyBO), bo.GetType());
            bo.SetPropertyValue("TestProp", "TestValue");
            Assert.AreEqual("TestValue", bo.GetPropertyValue("TestProp"));
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:21,代码来源:TestClassDef.cs


注:本文中的IClassDef.CreateNewBusinessObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。