public static IEdmModel Metadata() { //Создает модель EDM (модель EDM). OData Endpoint ODataModelBuilder builder = new ODataConventionModelBuilder(); builder.Namespace = poco.codeConfig.folderName; builder.ContainerName = "Default"; Assembly assembly = poco.assembly; var exportedTypes = assembly.GetExportedTypes(); foreach (Type typeClass in exportedTypes) { //Take from poco class a [TableAttribute] System.ComponentModel.DataAnnotations.Schema.TableAttribute tableAttribute = typeClass.GetCustomAttribute(typeof(System.ComponentModel.DataAnnotations.Schema.TableAttribute)) as System.ComponentModel.DataAnnotations.Schema.TableAttribute; //Ограничение EF https://stackoverflow.com/questions/18638741/the-type-company-model-user-and-the-type-company-core-model-user-both-have-t builder.AddClrObject(new AssemblyTableInfo { SqlTableOwner = tableAttribute.Schema, SqlTableName = tableAttribute.Name, AssemblyName = typeClass.Name, AssemblyFullName = typeClass.FullName, ClrTypeClass = typeClass, EntitySetName = typeClass.Name }); } EdmModel model = (EdmModel)builder.GetEdmModel(); return(model); }