本文整理汇总了C#中Microsoft.OData.Edm.Library.EdmEntityType.AddStructuralProperty方法的典型用法代码示例。如果您正苦于以下问题:C# EdmEntityType.AddStructuralProperty方法的具体用法?C# EdmEntityType.AddStructuralProperty怎么用?C# EdmEntityType.AddStructuralProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.OData.Edm.Library.EdmEntityType
的用法示例。
在下文中一共展示了EdmEntityType.AddStructuralProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReferentialConstraintDemo
private static void ReferentialConstraintDemo()
{
Console.WriteLine("ReferentialConstraintDemo");
EdmModel model = new EdmModel();
var customer = new EdmEntityType("ns", "Customer");
model.AddElement(customer);
var customerId = customer.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32, false);
customer.AddKeys(customerId);
var address = new EdmComplexType("ns", "Address");
model.AddElement(address);
var code = address.AddStructuralProperty("gid", EdmPrimitiveTypeKind.Guid);
customer.AddStructuralProperty("addr", new EdmComplexTypeReference(address, true));
var order = new EdmEntityType("ns", "Order");
model.AddElement(order);
var oId = order.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32, false);
order.AddKeys(oId);
var orderCustomerId = order.AddStructuralProperty("CustomerId", EdmPrimitiveTypeKind.Int32, false);
var nav = new EdmNavigationPropertyInfo()
{
Name = "NavCustomer",
Target = customer,
TargetMultiplicity = EdmMultiplicity.One,
DependentProperties = new[] { orderCustomerId },
PrincipalProperties = new[] { customerId }
};
order.AddUnidirectionalNavigation(nav);
ShowModel(model);
}
示例2: TestModelWithTypeDefinition
public void TestModelWithTypeDefinition()
{
var model = new EdmModel();
var addressType = new EdmTypeDefinition("MyNS", "Address", EdmPrimitiveTypeKind.String);
model.AddElement(addressType);
var weightType = new EdmTypeDefinition("MyNS", "Weight", EdmPrimitiveTypeKind.Decimal);
model.AddElement(weightType);
var personType = new EdmEntityType("MyNS", "Person");
var addressTypeReference = new EdmTypeDefinitionReference(addressType, false);
personType.AddStructuralProperty("Address", addressTypeReference);
addressTypeReference.Definition.Should().Be(addressType);
addressTypeReference.IsNullable.Should().BeFalse();
var weightTypeReference = new EdmTypeDefinitionReference(weightType, true);
personType.AddStructuralProperty("Weight", weightTypeReference);
weightTypeReference.Definition.Should().Be(weightType);
weightTypeReference.IsNullable.Should().BeTrue();
var personId = personType.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32);
personType.AddKeys(personId);
}
示例3: EnumMemberExpressionDemo
private static void EnumMemberExpressionDemo()
{
Console.WriteLine("EnumMemberExpressionDemo");
var model = new EdmModel();
var personType = new EdmEntityType("TestNS", "Person");
model.AddElement(personType);
var pid = personType.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32, false);
personType.AddKeys(pid);
personType.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String);
var colorType = new EdmEnumType("TestNS2", "Color", true);
model.AddElement(colorType);
colorType.AddMember("Cyan", new EdmIntegerConstant(1));
colorType.AddMember("Blue", new EdmIntegerConstant(2));
var outColorTerm = new EdmTerm("TestNS", "OutColor", new EdmEnumTypeReference(colorType, true));
model.AddElement(outColorTerm);
var exp = new EdmEnumMemberExpression(
new EdmEnumMember(colorType, "Blue", new EdmIntegerConstant(2))
);
var annotation = new EdmAnnotation(personType, outColorTerm, exp);
annotation.SetSerializationLocation(model, EdmVocabularyAnnotationSerializationLocation.Inline);
model.SetVocabularyAnnotation(annotation);
ShowModel(model);
var ann = model.FindVocabularyAnnotations<IEdmValueAnnotation>(personType, "TestNS.OutColor").First();
var memberExp = (IEdmEnumMemberExpression)ann.Value;
foreach (var member in memberExp.EnumMembers)
{
Console.WriteLine(member.Name);
}
}
示例4: GetModel
public void GetModel(EdmModel model, EdmEntityContainer container)
{
EdmEntityType student = new EdmEntityType("ns", "Student");
student.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String);
EdmStructuralProperty key = student.AddStructuralProperty("ID", EdmPrimitiveTypeKind.Int32);
student.AddKeys(key);
model.AddElement(student);
EdmEntitySet students = container.AddEntitySet("Students", student);
EdmEntityType school = new EdmEntityType("ns", "School");
school.AddKeys(school.AddStructuralProperty("ID", EdmPrimitiveTypeKind.Int32));
school.AddStructuralProperty("CreatedDay", EdmPrimitiveTypeKind.DateTimeOffset);
model.AddElement(school);
EdmEntitySet schools = container.AddEntitySet("Schools", student);
EdmNavigationProperty schoolNavProp = student.AddUnidirectionalNavigation(
new EdmNavigationPropertyInfo
{
Name = "School",
TargetMultiplicity = EdmMultiplicity.One,
Target = school
});
students.AddNavigationTarget(schoolNavProp, schools);
_school = school;
}
示例5: ODataSingletonDeserializerTest
public ODataSingletonDeserializerTest()
{
EdmModel model = new EdmModel();
var employeeType = new EdmEntityType("NS", "Employee");
employeeType.AddStructuralProperty("EmployeeId", EdmPrimitiveTypeKind.Int32);
employeeType.AddStructuralProperty("EmployeeName", EdmPrimitiveTypeKind.String);
model.AddElement(employeeType);
EdmEntityContainer defaultContainer = new EdmEntityContainer("NS", "Default");
model.AddElement(defaultContainer);
_singleton = new EdmSingleton(defaultContainer, "CEO", employeeType);
defaultContainer.AddElement(_singleton);
model.SetAnnotationValue<ClrTypeAnnotation>(employeeType, new ClrTypeAnnotation(typeof(EmployeeModel)));
_edmModel = model;
_edmContainer = defaultContainer;
_readContext = new ODataDeserializerContext
{
Path = new ODataPath(new SingletonPathSegment(_singleton)),
Model = _edmModel,
ResourceType = typeof(EmployeeModel)
};
_deserializerProvider = new DefaultODataDeserializerProvider();
}
示例6: WriterTypeNameEndToEndTests
public WriterTypeNameEndToEndTests()
{
var model = new EdmModel();
var type = new EdmEntityType("TestModel", "TestEntity", /* baseType */ null, /* isAbstract */ false, /* isOpen */ true);
var keyProperty = type.AddStructuralProperty("DeclaredInt16", EdmPrimitiveTypeKind.Int16);
type.AddKeys(new[] { keyProperty });
// Note: DerivedPrimitive is declared as a Geography, but its value below will be set to GeographyPoint, which is derived from Geography.
type.AddStructuralProperty("DerivedPrimitive", EdmPrimitiveTypeKind.Geography);
var container = new EdmEntityContainer("TestModel", "Container");
var set = container.AddEntitySet("Set", type);
model.AddElement(type);
model.AddElement(container);
var writerStream = new MemoryStream();
this.settings = new ODataMessageWriterSettings();
this.settings.SetServiceDocumentUri(ServiceDocumentUri);
// Make the message writer and entry writer lazy so that individual tests can tweak the settings before the message writer is created.
this.messageWriter = new Lazy<ODataMessageWriter>(() =>
new ODataMessageWriter(
(IODataResponseMessage)new InMemoryMessage { Stream = writerStream },
this.settings,
model));
var entryWriter = new Lazy<ODataWriter>(() => this.messageWriter.Value.CreateODataEntryWriter(set, type));
var valueWithAnnotation = new ODataPrimitiveValue(45);
valueWithAnnotation.SetAnnotation(new SerializationTypeNameAnnotation { TypeName = "TypeNameFromSTNA" });
var propertiesToWrite = new List<ODataProperty>
{
new ODataProperty
{
Name = "DeclaredInt16", Value = (Int16)42
},
new ODataProperty
{
Name = "UndeclaredDecimal", Value = (Decimal)4.5
},
new ODataProperty
{
// Note: value is more derived than the declared type.
Name = "DerivedPrimitive", Value = Microsoft.Spatial.GeographyPoint.Create(42, 45)
},
new ODataProperty()
{
Name = "PropertyWithSTNA", Value = valueWithAnnotation
}
};
this.writerOutput = new Lazy<string>(() =>
{
entryWriter.Value.WriteStart(new ODataEntry { Properties = propertiesToWrite });
entryWriter.Value.WriteEnd();
entryWriter.Value.Flush();
writerStream.Seek(0, SeekOrigin.Begin);
return new StreamReader(writerStream).ReadToEnd();
});
}
示例7: GetEdmModel
public static IEdmModel GetEdmModel()
{
EdmModel model = new EdmModel();
// Create and add product entity type.
EdmEntityType product = new EdmEntityType("NS", "Product");
product.AddKeys(product.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32));
product.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String);
product.AddStructuralProperty("Price", EdmPrimitiveTypeKind.Double);
model.AddElement(product);
// Create and add category entity type.
EdmEntityType category = new EdmEntityType("NS", "Category");
category.AddKeys(category.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32));
category.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String);
model.AddElement(category);
// Set navigation from product to category.
EdmNavigationPropertyInfo propertyInfo = new EdmNavigationPropertyInfo();
propertyInfo.Name = "Category";
propertyInfo.TargetMultiplicity = EdmMultiplicity.One;
propertyInfo.Target = category;
EdmNavigationProperty productCategory = product.AddUnidirectionalNavigation(propertyInfo);
// Create and add entity container.
EdmEntityContainer container = new EdmEntityContainer("NS", "DefaultContainer");
model.AddElement(container);
// Create and add entity set for product and category.
EdmEntitySet products = container.AddEntitySet("Products", product);
EdmEntitySet categories = container.AddEntitySet("Categories", category);
products.AddNavigationTarget(productCategory, categories);
return model;
}
示例8: GetEdmModel
public static IEdmModel GetEdmModel()
{
if (_edmModel != null)
{
return _edmModel;
}
EdmModel model = new EdmModel();
// entity type 'Customer' with single alternate keys
EdmEntityType customer = new EdmEntityType("NS", "Customer");
customer.AddKeys(customer.AddStructuralProperty("ID", EdmPrimitiveTypeKind.Int32));
customer.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String);
var ssn = customer.AddStructuralProperty("SSN", EdmPrimitiveTypeKind.String);
model.AddAlternateKeyAnnotation(customer, new Dictionary<string, IEdmProperty>
{
{"SSN", ssn}
});
model.AddElement(customer);
// entity type 'Order' with multiple alternate keys
EdmEntityType order = new EdmEntityType("NS", "Order");
order.AddKeys(order.AddStructuralProperty("OrderId", EdmPrimitiveTypeKind.Int32));
var orderName = order.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String);
var orderToken = order.AddStructuralProperty("Token", EdmPrimitiveTypeKind.Guid);
order.AddStructuralProperty("Amount", EdmPrimitiveTypeKind.Int32);
model.AddAlternateKeyAnnotation(order, new Dictionary<string, IEdmProperty>
{
{"Name", orderName}
});
model.AddAlternateKeyAnnotation(order, new Dictionary<string, IEdmProperty>
{
{"Token", orderToken}
});
model.AddElement(order);
// entity type 'Person' with composed alternate keys
EdmEntityType person = new EdmEntityType("NS", "Person");
person.AddKeys(person.AddStructuralProperty("ID", EdmPrimitiveTypeKind.Int32));
var country = person.AddStructuralProperty("Country", EdmPrimitiveTypeKind.String);
var passport = person.AddStructuralProperty("Passport", EdmPrimitiveTypeKind.String);
model.AddAlternateKeyAnnotation(person, new Dictionary<string, IEdmProperty>
{
{"Country", country},
{"Passport", passport}
});
model.AddElement(person);
// entity sets
EdmEntityContainer container = new EdmEntityContainer("NS", "Default");
model.AddElement(container);
container.AddEntitySet("Customers", customer);
container.AddEntitySet("Orders", order);
container.AddEntitySet("People", person);
return _edmModel = model;
}
示例9: GetModel
public void GetModel(EdmModel model, EdmEntityContainer container)
{
EdmEntityType product = new EdmEntityType("ns", "Student");
product.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String);
EdmStructuralProperty key = product.AddStructuralProperty("ID", EdmPrimitiveTypeKind.Int32);
product.AddKeys(key);
model.AddElement(product);
container.AddEntitySet("Students", product);
}
示例10: Initialize
public void Initialize()
{
this.model = new EdmModel();
EdmComplexType personalInfo = new EdmComplexType(MyNameSpace, "PersonalInfo");
personalInfo.AddStructuralProperty("Age", EdmPrimitiveTypeKind.Int16);
personalInfo.AddStructuralProperty("Email", EdmPrimitiveTypeKind.String);
personalInfo.AddStructuralProperty("Tel", EdmPrimitiveTypeKind.String);
personalInfo.AddStructuralProperty("ID", EdmPrimitiveTypeKind.Guid);
EdmComplexType derivedPersonalInfo = new EdmComplexType(MyNameSpace, "DerivedPersonalInfo", personalInfo);
derivedPersonalInfo.AddStructuralProperty("Hobby", EdmPrimitiveTypeKind.String);
EdmComplexType derivedDerivedPersonalInfo = new EdmComplexType(MyNameSpace, "DerivedDerivedPersonalInfo", derivedPersonalInfo);
derivedDerivedPersonalInfo.AddStructuralProperty("Education", EdmPrimitiveTypeKind.String);
EdmComplexType subjectInfo = new EdmComplexType(MyNameSpace, "Subject");
subjectInfo.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String);
subjectInfo.AddStructuralProperty("Score", EdmPrimitiveTypeKind.Int16);
EdmComplexType derivedSubjectInfo = new EdmComplexType(MyNameSpace, "DerivedSubject", subjectInfo);
derivedSubjectInfo.AddStructuralProperty("Teacher", EdmPrimitiveTypeKind.String);
EdmComplexType derivedDerivedSubjectInfo = new EdmComplexType(MyNameSpace, "DerivedDerivedSubject", derivedSubjectInfo);
derivedDerivedSubjectInfo.AddStructuralProperty("Classroom", EdmPrimitiveTypeKind.String);
EdmCollectionTypeReference subjectsCollection = new EdmCollectionTypeReference(new EdmCollectionType(new EdmComplexTypeReference(subjectInfo, isNullable: true)));
studentInfo = new EdmEntityType(MyNameSpace, "Student");
studentInfo.AddStructuralProperty("Info", new EdmComplexTypeReference(personalInfo, isNullable: false));
studentInfo.AddProperty(new EdmStructuralProperty(studentInfo, "Subjects", subjectsCollection));
// enum with flags
var enumFlagsType = new EdmEnumType(MyNameSpace, "ColorFlags", isFlags: true);
enumFlagsType.AddMember("Red", new EdmIntegerConstant(1));
enumFlagsType.AddMember("Green", new EdmIntegerConstant(2));
enumFlagsType.AddMember("Blue", new EdmIntegerConstant(4));
studentInfo.AddStructuralProperty("ClothesColors", new EdmCollectionTypeReference(new EdmCollectionType(new EdmEnumTypeReference(enumFlagsType, true))));
EdmCollectionTypeReference hobbiesCollection = new EdmCollectionTypeReference(new EdmCollectionType(EdmCoreModel.Instance.GetString(isNullable: false)));
studentInfo.AddProperty(new EdmStructuralProperty(studentInfo, "Hobbies", hobbiesCollection));
model.AddElement(enumFlagsType);
model.AddElement(studentInfo);
model.AddElement(personalInfo);
model.AddElement(derivedPersonalInfo);
model.AddElement(derivedDerivedPersonalInfo);
model.AddElement(subjectInfo);
model.AddElement(derivedSubjectInfo);
model.AddElement(derivedDerivedSubjectInfo);
IEdmEntityContainer defaultContainer = new EdmEntityContainer("NS", "DefaultContainer");
model.AddElement(defaultContainer);
this.studentSet = new EdmEntitySet(defaultContainer, "MySet", this.studentInfo);
}
示例11: CsvWriterDemo
private static void CsvWriterDemo()
{
EdmEntityType customer = new EdmEntityType("ns", "customer");
var key = customer.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32);
customer.AddKeys(key);
customer.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String);
ODataEntry entry1 = new ODataEntry()
{
Properties = new[]
{
new ODataProperty(){Name = "Id", Value = 51},
new ODataProperty(){Name = "Name", Value = "Name_A"},
}
};
ODataEntry entry2 = new ODataEntry()
{
Properties = new[]
{
new ODataProperty(){Name = "Id", Value = 52},
new ODataProperty(){Name = "Name", Value = "Name_B"},
}
};
var stream = new MemoryStream();
var message = new Message { Stream = stream };
// Set Content-Type header value
message.SetHeader("Content-Type", "text/csv");
var settings = new ODataMessageWriterSettings
{
// Set our resolver here.
MediaTypeResolver = CsvMediaTypeResolver.Instance,
DisableMessageStreamDisposal = true,
};
using (var messageWriter = new ODataMessageWriter(message, settings))
{
var writer = messageWriter.CreateODataFeedWriter(null, customer);
writer.WriteStart(new ODataFeed());
writer.WriteStart(entry1);
writer.WriteEnd();
writer.WriteStart(entry2);
writer.WriteEnd();
writer.WriteEnd();
writer.Flush();
}
stream.Seek(0, SeekOrigin.Begin);
string msg;
using (var sr = new StreamReader(stream)) { msg = sr.ReadToEnd(); }
Console.WriteLine(msg);
}
示例12: Initialize
public void Initialize()
{
this.edmModel = new EdmModel();
this.defaultContainer = new EdmEntityContainer("TestModel", "DefaultContainer");
this.edmModel.AddElement(this.defaultContainer);
this.townType = new EdmEntityType("TestModel", "Town");
this.edmModel.AddElement(townType);
EdmStructuralProperty townIdProperty = townType.AddStructuralProperty("Id", EdmCoreModel.Instance.GetInt32(/*isNullable*/false));
townType.AddKeys(townIdProperty);
townType.AddStructuralProperty("Name", EdmCoreModel.Instance.GetString(/*isNullable*/false));
townType.AddStructuralProperty("Size", EdmCoreModel.Instance.GetInt32(/*isNullable*/false));
this.cityType = new EdmEntityType("TestModel", "City", this.townType);
cityType.AddStructuralProperty("Photo", EdmCoreModel.Instance.GetStream(/*isNullable*/false));
this.edmModel.AddElement(cityType);
this.districtType = new EdmEntityType("TestModel", "District");
EdmStructuralProperty districtIdProperty = districtType.AddStructuralProperty("Id", EdmCoreModel.Instance.GetInt32(/*isNullable*/false));
districtType.AddKeys(districtIdProperty);
districtType.AddStructuralProperty("Zip", EdmCoreModel.Instance.GetInt32(/*isNullable*/false));
districtType.AddStructuralProperty("Thumbnail", EdmCoreModel.Instance.GetStream(/*isNullable*/false));
this.edmModel.AddElement(districtType);
cityType.AddBidirectionalNavigation(
new EdmNavigationPropertyInfo { Name = "Districts", Target = districtType, TargetMultiplicity = EdmMultiplicity.Many },
new EdmNavigationPropertyInfo { Name = "City", Target = cityType, TargetMultiplicity = EdmMultiplicity.One });
this.defaultContainer.AddEntitySet("Cities", cityType);
this.defaultContainer.AddEntitySet("Districts", districtType);
this.metropolisType = new EdmEntityType("TestModel", "Metropolis", this.cityType);
this.metropolisType.AddStructuralProperty("MetropolisStream", EdmCoreModel.Instance.GetStream(/*isNullable*/false));
this.edmModel.AddElement(metropolisType);
metropolisType.AddUnidirectionalNavigation(new EdmNavigationPropertyInfo { Name = "MetropolisNavigation", Target = districtType, TargetMultiplicity = EdmMultiplicity.ZeroOrOne });
this.action = new EdmAction("TestModel", "Action", new EdmEntityTypeReference(this.cityType, true));
this.action.AddParameter("Param", EdmCoreModel.Instance.GetInt32(false));
this.edmModel.AddElement(action);
this.actionImport = new EdmActionImport(this.defaultContainer, "Action", action);
this.actionConflictingWithPropertyName = new EdmAction("TestModel", "Zip", new EdmEntityTypeReference(this.districtType, true));
this.actionConflictingWithPropertyName.AddParameter("Param", EdmCoreModel.Instance.GetInt32(false));
this.edmModel.AddElement(actionConflictingWithPropertyName);
this.actionImportConflictingWithPropertyName = new EdmActionImport(this.defaultContainer, "Zip", actionConflictingWithPropertyName);
this.openType = new EdmEntityType("TestModel", "OpenCity", this.cityType, false, true);
}
示例13: SimpleCustomerOrderModel
public static IEdmModel SimpleCustomerOrderModel()
{
var model = new EdmModel();
var customerType = new EdmEntityType("Default", "Customer");
customerType.AddStructuralProperty("ID", EdmPrimitiveTypeKind.Int32);
customerType.AddStructuralProperty("FirstName", EdmPrimitiveTypeKind.String);
customerType.AddStructuralProperty("LastName", EdmPrimitiveTypeKind.String);
IEdmTypeReference primitiveTypeReference = EdmCoreModel.Instance.GetPrimitive(
EdmPrimitiveTypeKind.String,
isNullable: true);
customerType.AddStructuralProperty(
"City",
primitiveTypeReference,
defaultValue: null,
concurrencyMode: EdmConcurrencyMode.Fixed);
model.AddElement(customerType);
var orderType = new EdmEntityType("Default", "Order");
orderType.AddStructuralProperty("ID", EdmPrimitiveTypeKind.Int32);
orderType.AddStructuralProperty("Name", EdmPrimitiveTypeKind.String);
orderType.AddStructuralProperty("Shipment", EdmPrimitiveTypeKind.String);
model.AddElement(orderType);
var addressType = new EdmComplexType("Default", "Address");
addressType.AddStructuralProperty("Street", EdmPrimitiveTypeKind.String);
addressType.AddStructuralProperty("City", EdmPrimitiveTypeKind.String);
addressType.AddStructuralProperty("State", EdmPrimitiveTypeKind.String);
addressType.AddStructuralProperty("Country", EdmPrimitiveTypeKind.String);
addressType.AddStructuralProperty("ZipCode", EdmPrimitiveTypeKind.String);
model.AddElement(addressType);
// Add navigations
customerType.AddUnidirectionalNavigation(new EdmNavigationPropertyInfo() { Name = "Orders", Target = orderType, TargetMultiplicity = EdmMultiplicity.Many });
orderType.AddUnidirectionalNavigation(new EdmNavigationPropertyInfo() { Name = "Customer", Target = customerType, TargetMultiplicity = EdmMultiplicity.One });
// Add Entity set
var container = new EdmEntityContainer("Default", "Container");
var customerSet = container.AddEntitySet("Customers", customerType);
var orderSet = container.AddEntitySet("Orders", orderType);
customerSet.AddNavigationTarget(customerType.NavigationProperties().Single(np => np.Name == "Orders"), orderSet);
orderSet.AddNavigationTarget(orderType.NavigationProperties().Single(np => np.Name == "Customer"), customerSet);
NavigationSourceLinkBuilderAnnotation linkAnnotation = new MockNavigationSourceLinkBuilderAnnotation();
model.SetNavigationSourceLinkBuilder(customerSet, linkAnnotation);
model.SetNavigationSourceLinkBuilder(orderSet, linkAnnotation);
model.AddElement(container);
return model;
}
示例14: EdmReferentialConstraintTests
public EdmReferentialConstraintTests()
{
this.typeWithOneKey = new EdmEntityType("Fake", "OneKey");
this.typeWithOneKey.AddKeys(this.key1_1 = this.typeWithOneKey.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32));
property1 = this.typeWithOneKey.AddStructuralProperty("prop1", EdmPrimitiveTypeKind.String);
this.typeWithTwoKeys = new EdmEntityType("Fake", "TwoKeys");
this.typeWithTwoKeys.AddKeys(this.key2_1 = this.typeWithTwoKeys.AddStructuralProperty("Id1", EdmPrimitiveTypeKind.Int32));
this.typeWithTwoKeys.AddKeys(this.key2_2 = this.typeWithTwoKeys.AddStructuralProperty("Id2", EdmPrimitiveTypeKind.Int32));
property2 = this.typeWithTwoKeys.AddStructuralProperty("prop2", EdmPrimitiveTypeKind.String);
var otherType = new EdmEntityType("Fake", "Other");
this.otherTypeProperty1 = otherType.AddStructuralProperty("Property1", EdmPrimitiveTypeKind.Int32);
this.otherTypeProperty2 = otherType.AddStructuralProperty("Property2", EdmPrimitiveTypeKind.Int32);
}
示例15: AsyncRoundtripJsonLightTests
static AsyncRoundtripJsonLightTests()
{
userModel = new EdmModel();
testType = new EdmEntityType("NS", "Test");
testType.AddStructuralProperty("Id", EdmPrimitiveTypeKind.Int32);
testType.AddStructuralProperty("Dummy", EdmPrimitiveTypeKind.String);
userModel.AddElement(testType);
defaultContainer = new EdmEntityContainer("NS", "DefaultContainer");
userModel.AddElement(defaultContainer);
singleton = new EdmSingleton(defaultContainer, "MySingleton", testType);
defaultContainer.AddElement(singleton);
}