New Posts New Posts RSS Feed: Error generating entities in the object mapping tool
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Error generating entities in the object mapping tool

 Post Reply Post Reply
Author
paobriones View Drop Down
Newbie
Newbie
Avatar

Joined: 22-Jun-2007
Location: Philippines
Posts: 4
Post Options Post Options   Quote paobriones Quote  Post ReplyReply Direct Link To This Post Topic: Error generating entities in the object mapping tool
    Posted: 22-Jun-2007 at 6:28am
We previously generated a model for our database. Afterwards, when we made changes to the tables and their constraints; then try to re-generate the entities in the object mapping tool we always get the following error:
 
Unable to Generate
The following files cannot be written to.
The files or their directory may be write protected.
 
Please unprotect them before continuing
[the list of TableName.cs and TableNameDataRow.cs here]
 
this only happens for newly added tables in the database, but changes in existing mapped tables are regenerated properly. We looked into the directory where the model is located, and all the files were read/write and we noticed that the files that the error message has listed do not exist yet. the directory's security settings are ok.
 
when we tried to generate a new model based on the updated database, the object mapping tool generates the new model with no problems. but again, if we add new tables into the database and re-generate...same problem!
 
We're using VS2005 Team System + SP1 and SQL Server 2005 + no sp
Windows XP + SP2 + All latest Updates, P4 3.2Ghz 1gb ram 120gb hdd
Visual Source Safe 2005; Ideablade DevForce v3.5.1.1
 
We are also using Resharper 2.51 (but we uninstalled this from our machines just to be sure, but this error is still occurring)
 
we tried re-generating the model in our other development machines,
and this happens in all our development machines;
 
Is there a workaround to this? or any known causes?
 
Thanks in advance.
Back to Top
Linguinut View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 394
Post Options Post Options   Quote Linguinut Quote  Post ReplyReply Direct Link To This Post Posted: 22-Jun-2007 at 8:42am
Make sure all of the files have been checked out of VSS before rerunning the object mapper.
Back to Top
paobriones View Drop Down
Newbie
Newbie
Avatar

Joined: 22-Jun-2007
Location: Philippines
Posts: 4
Post Options Post Options   Quote paobriones Quote  Post ReplyReply Direct Link To This Post Posted: 22-Jun-2007 at 9:55am
All the files are checked out before we run the object mapping tool
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post Posted: 22-Jun-2007 at 10:08am

Paobriones,

You said that you "made changes to the tables and their constraints",  Did you set the constraints in the database itself, or did you also set constrainsts in the ORM Tool?
 
Back to Top
Linguinut View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14-Jun-2007
Location: United States
Posts: 394
Post Options Post Options   Quote Linguinut Quote  Post ReplyReply Direct Link To This Post Posted: 22-Jun-2007 at 10:25am

Have you tried removing the model project from VSS, then trying the ORM operation?

Back to Top
paobriones View Drop Down
Newbie
Newbie
Avatar

Joined: 22-Jun-2007
Location: Philippines
Posts: 4
Post Options Post Options   Quote paobriones Quote  Post ReplyReply Direct Link To This Post Posted: 22-Jun-2007 at 6:01pm
Yes, we made changes to the tables like creating fk constraints, ck constraints and modifying the indexes.
 
since there was an error in the generation of the entities, we re-generated a new model; but when we deleted the old model and ran the project there was an exception "Invalid object 'dbo.tablename'".
 
but we were able to solve this by changing the data source key name and re-running the project.
 
we werent doing anything with the files or modifying its contents, we were just generating via the object mapping tool
Back to Top
paobriones View Drop Down
Newbie
Newbie
Avatar

Joined: 22-Jun-2007
Location: Philippines
Posts: 4
Post Options Post Options   Quote paobriones Quote  Post ReplyReply Direct Link To This Post Posted: 22-Jun-2007 at 6:03pm
although we have solved the model problem and the invalid object problem; this raises some concern for us as we go deeper into the project; changes to databases may trigger another error in the entity generation...
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down