public EdmModel GetModel() { EdmModel model = new EdmModel(); EdmEntityContainer container = new EdmEntityContainer("ns", "container"); model.AddElement(container); var databaseTables = _schemaReader.GetTables(null); foreach (var table in databaseTables) { var entityType = BuildEdmEntityType(table); string setName = table.Name.Replace(" ", string.Empty); model.AddElement(entityType); container.AddEntitySet(setName, entityType); } return(model); }