public static IEdmModel SimpleValueAnnotationOnContainerAndEntitySet() { StubEdmModel model = new StubEdmModel(); CreateVocabularyDefinitions(model); var person = new StubEdmEntityType("NS1", "Person"); var container = new StubEdmEntityContainer("NS1", "Container"); var personSet = new StubEdmEntitySet("PersonSet", container) { Type = new EdmCollectionType(new EdmEntityTypeReference(person, false)) }; container.Add(personSet); model.Add(container); model.Add(person); var titleValueTerm = model.FindValueTerm("NS1.Title"); var titleValueAnnotation = new StubValueAnnotation() { Term = titleValueTerm, Value = new StubStringConstantExpression("Sir") }; container.AddVocabularyAnnotation(titleValueAnnotation); personSet.AddVocabularyAnnotation(titleValueAnnotation); return model; }
public static IEdmModel MultipleValueAnnotations() { StubEdmModel model = new StubEdmModel(); CreateVocabularyDefinitions(model); var person = new StubEdmEntityType("NS1", "Person") { new StubEdmStructuralProperty("Id") { Type = EdmCoreModel.Instance.GetInt16(false) }, new StubEdmStructuralProperty("FirstName") { Type = EdmCoreModel.Instance.GetString(false) }, new StubEdmStructuralProperty("LastName") { Type = EdmCoreModel.Instance.GetString(false) }, }; var titleValueTerm = model.FindValueTerm("NS1.Title"); var titleValueAnnotation = new StubValueAnnotation() { Term = titleValueTerm, Value = new StubStringConstantExpression("Sir") }; person.AddVocabularyAnnotation(titleValueAnnotation); var displaySizeValueTerm = model.FindValueTerm("NS1.DisplaySize"); var displaySizeValueAnnotation = new StubValueAnnotation() { Term = displaySizeValueTerm, Value = new StubStringConstantExpression("1024") }; person.AddVocabularyAnnotation(displaySizeValueAnnotation); model.Add(person); var container = new StubEdmEntityContainer("NS1", "Container"); var personSet = new StubEdmEntitySet("PersonSet", container) { Type = new EdmCollectionType(new EdmEntityTypeReference(person, false)) }; personSet.AddVocabularyAnnotation(titleValueAnnotation); container.Add(personSet); model.Add(container); return model; }