Example #1
0
        private static void CustomTermDemo()
        {
            Console.WriteLine("CustomTermDemo");

            var model = new EdmModel();
            model.SetNamespaceAlias("ns", "Alias1");
            var term = new EdmTerm("ns", "ErrorCodes",
                new EdmCollectionTypeReference(new EdmCollectionType(EdmCoreModel.Instance.GetString(false))));
            model.AddElement(term);
            var entity1 = new EdmEntityType("ns", "entity1");
            entity1.AddKeys(entity1.AddStructuralProperty("id", EdmPrimitiveTypeKind.Guid));
            model.AddElement(entity1);
            var container = new EdmEntityContainer("ns", "default");
            model.AddElement(container);
            var e1 = container.AddSingleton("E1", entity1);

            var annotation = new EdmAnnotation(e1, term,
                new EdmCollectionExpression(
                    new EdmStringConstant("Entity Not Found"),
                    new EdmStringConstant("Deleting link failed")));

            model.AddVocabularyAnnotation(annotation);

            ShowModel(model);
        }