本文整理汇总了C#中System.Data.Entity.Core.Metadata.Edm.EdmProperty.SetClrPropertyInfo方法的典型用法代码示例。如果您正苦于以下问题:C# EdmProperty.SetClrPropertyInfo方法的具体用法?C# EdmProperty.SetClrPropertyInfo怎么用?C# EdmProperty.SetClrPropertyInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.Entity.Core.Metadata.Edm.EdmProperty
的用法示例。
在下文中一共展示了EdmProperty.SetClrPropertyInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Can_configure_result_bindings
public void Can_configure_result_bindings()
{
var modificationFunctionConfiguration = new ModificationFunctionConfiguration();
var mockPropertyInfo = new MockPropertyInfo();
modificationFunctionConfiguration
.Result(new PropertyPath(mockPropertyInfo), "Foo");
var entitySet = new EntitySet();
entitySet.ChangeEntityContainerWithoutCollectionFixup(new EntityContainer("C", DataSpace.CSpace));
var property = new EdmProperty("P1");
property.SetClrPropertyInfo(mockPropertyInfo);
var resultBinding = new StorageModificationFunctionResultBinding("Bar", property);
modificationFunctionConfiguration.Configure(
new StorageModificationFunctionMapping(
entitySet,
new EntityType("E", "N", DataSpace.CSpace),
new EdmFunction("F", "N", DataSpace.SSpace),
new[]
{
new StorageModificationFunctionParameterBinding(
new FunctionParameter(
"P",
TypeUsage.Create(
PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.String)),
ParameterMode.In),
new StorageModificationFunctionMemberPath(new[] { property }, null), false)
},
null,
new[] { resultBinding }));
Assert.Equal("Foo", resultBinding.ColumnName);
}
示例2: Configure_should_ensure_consistency_of_constraint_when_already_configured
public void Configure_should_ensure_consistency_of_constraint_when_already_configured()
{
var associationType = new AssociationType("A", XmlConstants.ModelNamespace_3, false, DataSpace.CSpace);
associationType.SourceEnd = new AssociationEndMember("S", new EntityType("SE", "N", DataSpace.CSpace));
var targetEntityType = new EntityType("TE", "N", DataSpace.CSpace);
var propertyInfo = new MockPropertyInfo(typeof(int), "P2").Object;
var property = new EdmProperty("P2", TypeUsage.Create(PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Int32)));
targetEntityType.AddMember(property);
property.SetClrPropertyInfo(propertyInfo);
associationType.TargetEnd = new AssociationEndMember("T", targetEntityType);
var navigationPropertyConfigurationA
= new NavigationPropertyConfiguration(new MockPropertyInfo(typeof(AType1), "N1"));
associationType.SetConfiguration(navigationPropertyConfigurationA);
var constraint = new ForeignKeyConstraintConfiguration(
new[]
{
propertyInfo
});
var navigationPropertyConfigurationB
= new NavigationPropertyConfiguration(new MockPropertyInfo(typeof(AType1), "N2"))
{
Constraint = constraint
};
navigationPropertyConfigurationB.Configure(
new NavigationProperty("N", TypeUsage.Create(associationType.TargetEnd.GetEntityType()))
{
RelationshipType = associationType
},
new EdmModel(DataSpace.CSpace), new EntityTypeConfiguration(typeof(object)));
Assert.Equal(constraint, navigationPropertyConfigurationA.Constraint);
}