Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 24th, 2010, 06:49 PM
Friend of Wrox
 
Join Date: Mar 2010
Posts: 100
Thanks: 21
Thanked 6 Times in 4 Posts
Default 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.
Reply With Quote
  #2 (permalink)  
Old November 24th, 2010, 07:02 PM
Friend of Wrox
 
Join Date: Mar 2010
Posts: 100
Thanks: 21
Thanked 6 Times in 4 Posts
Default

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.
Reply With Quote
  #3 (permalink)  
Old November 25th, 2010, 02:52 AM
Imar's Avatar
Wrox Author
Points: 71,154, Level: 100
Points: 71,154, Level: 100 Points: 71,154, Level: 100 Points: 71,154, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,944
Thanks: 79
Thanked 1,554 Times in 1,531 Posts
Default

Hi Rushino,

What do you mean with "i can't seem to include the Entity Model in my default.aspx file."?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #4 (permalink)  
Old November 25th, 2010, 06:31 AM
Friend of Wrox
 
Join Date: Mar 2010
Posts: 100
Thanks: 21
Thanked 6 Times in 4 Posts
Default

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 06:34 AM.
Reply With Quote
  #5 (permalink)  
Old November 25th, 2010, 06:58 AM
Imar's Avatar
Wrox Author
Points: 71,154, Level: 100
Points: 71,154, Level: 100 Points: 71,154, Level: 100 Points: 71,154, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,944
Thanks: 79
Thanked 1,554 Times in 1,531 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
Rushino (November 25th, 2010)
  #6 (permalink)  
Old November 25th, 2010, 07:48 AM
Friend of Wrox
 
Join Date: Mar 2010
Posts: 100
Thanks: 21
Thanked 6 Times in 4 Posts
Default

Alright thanks! That probably the root of the problem.
Reply With Quote
  #7 (permalink)  
Old November 25th, 2010, 10:58 AM
Imar's Avatar
Wrox Author
Points: 71,154, Level: 100
Points: 71,154, Level: 100 Points: 71,154, Level: 100 Points: 71,154, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,944
Thanks: 79
Thanked 1,554 Times in 1,531 Posts
Default

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
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #8 (permalink)  
Old June 12th, 2013, 05:17 PM
Registered User
Points: 32, Level: 1
Points: 32, Level: 1 Points: 32, Level: 1 Points: 32, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Marietta, GA, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 03: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



All times are GMT -4. The time now is 09:41 PM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.