Update Model from DB - Schema not available

Discussion of open issues, suggestions and bugs regarding Entity Developer - ORM modeling and code generation tool
Post Reply
ODN
Posts: 10
Joined: Mon 14 Jan 2013 05:25

Update Model from DB - Schema not available

Post by ODN » Tue 04 Feb 2014 16:37

Hi, I have a rather huge model, until now without any problems. This day I tried to update the model from database just to recognize that one schema (one among many) didn't show up in the update wizzard. Instead, it marked all tables / entities within this schema as dropped. The corresponding tables are still within the same schema when you check them with sql management studio. Starting a clean new project, the schema is not available for model generation. But if you use the ADO.Net entity framework wizzard, the schema shows up normally. I have no idea what is going on. Any suggestions regarding this problem? I am complettly stuck not beeing able to add or update tables / entities any longer.

Thanks for any help.

Oliver

Shalex
Site Admin
Posts: 8248
Joined: Thu 14 Aug 2008 12:44

Re: Update Model from DB - Schema not available

Post by Shalex » Wed 05 Feb 2014 17:15

Please open your model, navigate to Model Explorer > Store part > Tables/Views and check whether or not the Schema property is specified for the tables being marked as "Droped" by Update From Database Wizard.

Then make sure that the corresponding tables exist in the same schema of your database. If no default schema is defined for a user account, SQL Server will assume dbo is the default schema.

If this doesn't help, specify the following information:
1) the exact version (x.x.xxx) of your Entity Developer
2) the exact version of your SQL Server
3) new model -> that particular schema is not available on the "Select database objects" step (select "Group by schemas") in Create Model Wizard, is it?
4) existing model -> that particular schema is not available on the "Choose schemas" step in Update From Database Wizard, is it?
5) are newly created schemas available in Create Model Wizard and Update From Database Wizard?

ODN
Posts: 10
Joined: Mon 14 Jan 2013 05:25

Re: Update Model from DB - Schema not available

Post by ODN » Sun 09 Feb 2014 15:56

Please open your model, navigate to Model Explorer > Store part > Tables/Views and check whether or not the Schema property is specified for the tables being marked as "Droped" by Update From Database Wizard.
-> Schema is correctly set

Then make sure that the corresponding tables exist in the same schema of your database.
-> tables all exist in the correponding Schema
If no default schema is defined for a user account, SQL Server will assume dbo is the default schema.
-> don`t know what to do

If this doesn't help, specify the following information:
1) the exact version (x.x.xxx) of your Entity Developer 5.7.286 newest
2) the exact version of your SQL Server 2008 R2
3) new model -> that particular schema is not available on the "Select database objects" step (select "Group by schemas") in Create Model Wizard, is it? yes
4) existing model -> that particular schema is not available on the "Choose schemas" step in Update From Database Wizard, is it? yes
5) are newly created schemas available in Create Model Wizard and Update From Database Wizard? yes!

Shalex
Site Admin
Posts: 8248
Joined: Thu 14 Aug 2008 12:44

Re: Update Model from DB - Schema not available

Post by Shalex » Tue 11 Feb 2014 11:15

Please run this SQL (with account used in your model) and check whether or not the missing schema is present in the result set:

Code: Select all

SELECT 
  s.name 
FROM 
  sys.schemas s, sys.database_principals p
WHERE 
  s.principal_id = p.principal_id  AND (p.type = 'S' or p.type = 'U')
  AND s.name <> 'INFORMATION_SCHEMA'
  AND s.name <> 'sys'
If the schema is not available, execute the following SQL (now the missing schema should be in the result set) and tell us the type of the corresponding database principal (p.type):

Code: Select all

SELECT 
  s.name, p.type
FROM 
  sys.schemas s, sys.database_principals p
WHERE 
  s.principal_id = p.principal_id
  AND s.name <> 'INFORMATION_SCHEMA'
  AND s.name <> 'sys'

Post Reply