 |
| ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 4 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

November 24th, 2010, 07:49 PM
|
|
Friend of Wrox
|
|
Join Date: Mar 2010
Posts: 99
Thanks: 21
Thanked 6 Times in 4 Posts
|
|
Having problems with Entity Framework
Hello,
I refactored the name of my Entity Framework model and im getting this error.
Server Error in '/' Application.
Schema specified is not valid. Errors:
App_Code.EFLINQ.ssdl(3,4) : error 0019: The EntityContainer name must be unique. An EntityContainer with the name 'EFLINQModelStoreContainer' is already defined.
App_Code.EFLINQ.ssdl(11,4) : error 0019: Each type name in a schema must be unique. Type name 'EFLINQModel.Store.Personnes' was already defined.
App_Code.EFLINQ.ssdl(21,4) : error 0019: Each type name in a schema must be unique. Type name 'EFLINQModel.Store.Roles' was already defined.
App_Code.EFLINQ.ssdl(29,4) : error 0019: Each type name in a schema must be unique. Type name 'EFLINQModel.Store.FK_Personnes_Roles' was already defined.
Any ideas ?
Thanks.
|
|

November 24th, 2010, 08:02 PM
|
|
Friend of Wrox
|
|
Join Date: Mar 2010
Posts: 99
Thanks: 21
Thanked 6 Times in 4 Posts
|
|
Seem i fixed the problem it was due to the connection string.
"metadata=res://EFLINQ_wASPxGridView/App_Code.EFLINQ.cs
after the res:// you should specify the project assembly name.
Now i have another problem.. i can't seem to include the Entity Model in my default.aspx file.
|
|

November 25th, 2010, 03:52 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Rushino,
What do you mean with "i can't seem to include the Entity Model in my default.aspx file."?
Imar
|
|

November 25th, 2010, 07:31 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2010
Posts: 99
Thanks: 21
Thanked 6 Times in 4 Posts
|
|
Hi Imar,
Well that not what i meant. Actually i had lots of problem with Entity Framwork 4 with a Web Application Project. I am correct to think that they are not at all the same ? (vs website projects)
I was adding the entity model in the App_Code folder but wasnt unable to make it being seen by others classes even if i imported the namespace. (i figured out App_Code wasnt supported to a web application project)
I also had to add 2 assembly entry in the web.config to make it work :
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<add assembly="System.Data.Entity.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
If you ever refactoring the entity model.. you now get errors such :
Schema specified is not valid. Errors:
App_Code.EFLINQ.ssdl(3,4) : error 0019: The EntityContainer name must be unique. An EntityContainer with the name 'EFLINQModelStoreContainer' is already defined.
App_Code.EFLINQ.ssdl(11,4) : error 0019: Each type name in a schema must be unique. Type name 'EFLINQModel.Store.Personnes' was already defined.
App_Code.EFLINQ.ssdl(21,4) : error 0019: Each type name in a schema must be unique. Type name 'EFLINQModel.Store.Roles' was already defined.
App_Code.EFLINQ.ssdl(29,4) : error 0019: Each type name in a schema must be unique. Type name 'EFLINQModel.Store.FK_Personnes_Roles' was already defined.
The Entity Contexte must be unique... ?? ok but i had only one ?? lol dunno what happened. So the best bet is to create a Classe Folder and then put our classes in it.. and i have to add an import to the [AssemblyProjectName].Classes to access thoses classes.. since adding the model to the directory.. it consider to be added to the namespace .Classes.. so.
I couldn't use the Import EntityModel; import as mentionned in your book is there any reasons ? i suppose its because its a web application ?
I can't use a web site project because i need dll deployment support.
Thanks.
Last edited by Rushino; November 25th, 2010 at 07:34 AM..
|
|

November 25th, 2010, 07:58 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Rushino,
When you use a Web Application Project, you can't use App_Code. Simply create another folder, such as Code or Classes and add your EF model to that folder.
Cheers,
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

November 25th, 2010, 08:48 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2010
Posts: 99
Thanks: 21
Thanked 6 Times in 4 Posts
|
|
Alright thanks! That probably the root of the problem.
|
|

November 25th, 2010, 11:58 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Yes, I guess so. When used in an Web App, App_Code is compiled twice: once at development time into your assembly, and once at run-time, causing all kinds of conflicts such as duplicate types.
Cheers,
Imar
|
|

June 12th, 2013, 05:17 PM
|
|
Registered User
|
|
Join Date: Aug 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks, Too!
I know this is an old answer, but it helped me after a day of fruitless trials. Imar is the best and has helped me for years!
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| Entity Framework And MVC |
geomar |
BOOK: Professional ASP.NET MVC 1.0 ISBN: 978-0-470-38461-9 |
5 |
January 24th, 2011 04:58 PM |
| Entity Framework vs datasets? |
hoss |
BOOK: Beginning ASP.NET 4 : in C# and VB |
1 |
September 30th, 2010 02:42 AM |
| Switching To entity framework |
luckystar |
BOOK: ASP.NET 3.5 Enterprise Application Development with Visual Studio 2008: Problem Design Solutio |
0 |
July 31st, 2009 09:52 PM |
| The BeerHouse and Entity Framework |
docluv |
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 |
0 |
October 3rd, 2008 01:32 PM |
|
 |