Print Page | Close Window

Error generating entities in the object mapping tool

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=91
Printed Date: 12-Jun-2026 at 9:59am


Topic: Error generating entities in the object mapping tool
Posted By: paobriones
Subject: Error generating entities in the object mapping tool
Date 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.



Replies:
Posted By: Linguinut
Date Posted: 22-Jun-2007 at 8:42am
Make sure all of the files have been checked out of VSS before rerunning the object mapper.


Posted By: paobriones
Date Posted: 22-Jun-2007 at 9:55am
All the files are checked out before we run the object mapping tool


Posted By: davidklitzke
Date 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?
 


Posted By: Linguinut
Date Posted: 22-Jun-2007 at 10:25am

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



Posted By: paobriones
Date 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


Posted By: paobriones
Date 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...



Print Page | Close Window