Tracking Forums, Newsgroups, Maling Lists
Home Submit Tracker Forums
  Advanced Search


MVC :: EF Design / "Entities In 'EntityContainer.ProductTypes' Error

I have two entities: Product and ProductType. I've generated a controller and views for both and can manage ProductTypes, however, when attempting to create a new Product, I get the error below:

"Entities in 'EntityContainer.ProductTypes' participate in the 'ProductProductType' relationship. 0 related 'Product' were found. 1 'Product' is expected."

the reason being that my view, as automatically generated, doesn't know about ProductType. how is this generally handled? I would like to display a listbox of product types on the product form and insert the right value.

View 15 Replies (Posted: Mar 23, 2011 02:08 AM)

Sponsored Links:

Related Forum Messages For ASP.NET category:
ADO.NET :: EF4 Entities / Create Entities, For Instance, That Only Contains Contact Details Of Client Table?
I have a datamodel with a couple of tables. One of my tables have about 40 fields (I know that is a lot, but we have to keep the structure in place as we are upgrading a classic ASP project to MVC). Some of my Actions only updates 1 or 2 fields in my table.

Is there a way to create Entities, for instance, that only contains the contact details of the client table, and not any other details, and then another entity that contains only the address details. I don't want to submit the entire row when I only update telephone details, or the client's picture.

Posted: Nov 16, 2010 09:04 AM

View 1 Replies!   View Related
DataSource Controls :: FK Relationship Error In ADO Entities?
I'm getting this error: Entities in 'Oop4Entities.sssMenuRole' participate in the 'FK_sssMenuRole_sssMenu' relationship. 0 related 'sssMenu' were found. 1 'sssMenu' is expected. what does that mean? What am I doing wrong in regard to the foreign key?

Posted: Dec 08, 2008 06:47 PM

View 3 Replies!   View Related
Addhandler Causes 'Error Creating Control - MainContent' Error In Design View?
I'm working on a page that uses a master page. In the master page, I have a drop-down and when a value is selected I generate an evenIn the web page, I havethis statement"Addhandler Master.FilterChanged, AddressOf FilterChangedFromMasterPage"Everything works fine, and can edit the page as much as I want, but only with the Source view - because if I look at the design view, the entire MainContent section is reduced tothis error;"Error Creating Control- MainContent / Object Reference not set to an instance of an object"But if I debug it locally, or FTP it to the server, it works just fine!

Posted: Dec 11, 2010 05:31 PM

View 1 Replies!   View Related
Domain Entities Vs Business Entities (and More)?
I came across the one-level-down concept for layer dependencies that states that each layer should not need to know about any layer other than the one directly under it. By this token, at it's simplest, I have come up with the following flow, where presentation and service are to be viewed as parallel:

web -- presentation

I'll start with the persistance layer. In typical conventions, this is where we store our domain entities, raw data provider, and our repository interfaces.Now, I can see one problem with this organization already. The persistance layer (repositories) will be sending domain entities, or enumerables of them, back to the service layer. The service layer will need to know about the domain entities, but according to the one-level-down concept, this isn't possible. So, for the sake of this post, let's combine things a bit. We now have the following:

web -- presentation

In this scenario, the domain layer now contain the repository implementations as well. In a way, this makes at least a bit of sense as the domain entities, the data provider, and the repositories together make up the entirety of the DAL (data access layer). And yes, I know, common conventions say otherwise. But now our service layer only has to reference the domain layer, which agrees with the one-level-down concept.

Now let's look at the service layer a moment. It will be sending and receiving data to the repositories in the form of domain entities. These entities are basically glorified dto's that are bound through whatever ORM (object relational mapper) you use. In most cases, unless you use stored procedures, they will typically correspond to entire row in a given table.

Since the domain entities go out of scope above the service layer in the one-level-down concept, we have a problem when it comes to the calling controller. How do we get the data from the service to that controller? The answer is another set of entities. Namely unmapped business entities. These entities may, or may not parallel your domain entities, or they may be radically different.

Let's take a simple scenario and look at it. I have a controller called ArticleController which has a Manager action. What it wants to do is list all submitted articles that need approval. The only data we need is the id and title. So we look at our repository and see there is a method called GetPendingArticles but it returns a list of Article domain entities. Since we do not want our domain entity escaping our service boundary, nor do we need all the fields present in the domain entity, we create a new business entity to return in it's stead. The resulting business entity and service method may look something like this:

public class GetPendingArticleItem
public int ID { get; set; }
So what we've done now is put a stop barrier on the domain entities from escaping the service layer. Assuming we do the same thing for data coming in from the controller to the service, our web layer (the mvc app with the controllers) can now reference just the service layer and never have to know anything at all about the repositories and domain entities. The reason we have to create this little dto though, is because we cannot pass an anonymous type around.

While it's true that this denotes creating a great deal more classes than one really wants to do, but it makes a lot of sense to me.

Posted: Aug 6, 2009, 15:12

View 8 Replies!   View Related
Self Tracking Entities Vs POCO Entities
We are starting a new web based product in which we are planning to expose our business logic through WCF services. We will be using ASP.NET 4.0, C#, EF 4.0. In future we want to build iphone applications and WPF applications based on the services. I have been reading a lot about using POCO vs Self Tracking Entities (STE) and from my understand the STEs do not work well with the web scenario.

Posted: Sep 28 10 at 16:00

View 3 Replies!   View Related
Passing Entities Across Tiers / Opinions On Best Practices To Passing Entities Beyond Assembly Boundaries
I'm looking for opinions on best practices with regards to passing entities beyond assembly boundaries. I'm using Linq-To-SQL, but the same question would apply to Entity Framework, NHibernate, etc.

I have an assembly that I want to reuse in multiple projects. In it there are several entities which I have so far kept internal, however I am finding it would be beneficial to return a list of the entities to the caller. Should I create a new class to encapsulate the data or should I just expose the entity itself.

For example, let's say I have an Address entity. Would it be better to have a method GetAddress(...) that returns the Address entity, or should I create another class with the same properties to expose the Address data?

Posted: Dec 11, 2009 03:38 PM

View 3 Replies!   View Related
ADO.NET :: MVC Error "LINQ To Entities Does Not Recognize The Method 'SocialSports.Models.match"
When i use the query **var NewMatchs = (from x in entity.matches select x).LastOrDefault();** I got error like this **LINQ to Entities does not recognize the method 'SocialSports.Models.match LastOrDefault[match](System.Linq.IQueryable`1[SocialSports.Models.match])' method, and this method cannot be translated into a store expression.**

Posted: Feb 01, 2011 09:07 AM

View 1 Replies!   View Related
Design Error...Tables Not Aligning Right?
I am having some trouble with designing a masterpage for my site. In IE 8 the left menu pane stretches out every time i add a pic to the top table. When in compatiblity mode this is not a problem

Posted: Mar 10th, 2011, 09:28 AM

View 14 Replies!   View Related
C# - Web Service API Design - Input Validation And Error Response?
This might be a silly question, how do you usually response to errors? Response with one error at a time or Response with multiple errors at a time, in a list record


Invalid Email Address format
Invalid Phone number format
Invalid Password .etc...
Invalid API credentials

Posted: Jan 1 at 0:16

View 2 Replies!   View Related
AJAX :: TabControl Inside FormView Throws Error In Design Time
I'm trying touse a Tab control with 5 tabs inside a form view, when I view my aspx page in Visual Studio 2008 it displays a error message stating "There was an error rendering the control. Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "" was coreectly embedded or linked into assembly ... " running the site just shows a blank page (as the control isn't rendered).

If I remove the tab control from within the ItemTemplate (or EditItemTemplate) and put it directly onto the page it works fine. Googling for the errorsuggests the references aren't correct, so I've reset the toolbox, and re-added the reference - this time referencing the file in my Bin folder (not the installation path of the Ajax Toolkit). Still it throws the same error. Finally I've stripped the code out into a page with the bare minimum (no code behind) and it still throws the same error. I'm sure I had this working previously. I'musing Visual Studio 2008 onWindows 7 andI'm using the3.5 files from Codeplex ( targetting .NET Framework 3.5.

Posted: Dec 09, 2010 02:00 PM

View 2 Replies!   View Related
AJAX :: ASPToolKit: Accordion Control Rendering Error Message In Design Mode?
I'm receiving the following error in DesignMode with the Accordion1 control. Not sure what is causing this. This is my ASP WebApp.Error Rendering Control - Accordion1 An unhandled exception has occurred. Collection was modified; enumeration operation may not execute.Any idea, what causes this error?Code VS 2005 Pro ASP Ajax XP SP3

Posted: Jan 04, 2011 10:53 AM

View 3 Replies!   View Related
AJAX :: Combobox Rendering Error In Visual Studio 2008 Design View?
i am using the combobox ajax control i in design time i am having an error:

there was an error rendering the control. Request is not available in the context.

Posted: Jan 20, 2010 12:06 PM

View 1 Replies!   View Related
Error In Creating Control Content Placeholder1 Visual Studio 2010 Design Mode
After I imported a VS 2008 web project to VS 2010, I can't view aspx pages that have master pages in design mode. The page design mode displays "error creating control - contentplacehoder1 object reference not set to an instance of an object." The project builds and runs fine though. I have only one master page that all other aspx pages reference and I don't have any nested master pages.

Posted: Oct 20, 2010 10:51 PM

View 2 Replies!   View Related
Visual Studio :: Design View Is Not Able To Pull In The Application For Design?
can't connect to sql 2005 express sp1 and vs is also sp1. 2) Which my guess is because of the database connection not being able... design view is not able to pull in the application for design, it's as if there is no theme and css just whitebackground and black print.

Posted: Feb 23, 2010 03:39 AM

View 1 Replies!   View Related
Why When Drag The Crystal Report Viewer From Toolbox To Design Form Then Will Show Error Creating Contro
Can any one tell me why when i drag the Crystal Report Viewer from toolbox to my design form then will show Error Creating Control?

Posted: Jan 31 09

View 2 Replies!   View Related
AJAX :: Control Editor / Error Unknown Server Tag On The Design Time, And Iat Runtime It Is Working Properly?
I have created a custom user control and place Ajax editor and override the class of ajax editor to disable few buttons in editor ,

i am getting the following error

unknown server tag on the design time, and iat runtime it is working properly,

Posted: May 13, 2010 05:17 AM

View 2 Replies!   View Related
Why Rad Controls Design Is Not Visible At Design Time In Solution
I installed Rad Controls. Using that controls, I designed my application pages. At design time, the design is not visible. It shows the following error:

RadTabStrip1Failed to create designer 'Telerik.Web.UI.RadTabStrip, Telerik.Web.UI, Version=2010.1.415.35, Culture=neutral, PublicKeyToken=121fae78165ba3d4'

Posted: Feb 27 at 9:57

View 2 Replies!   View Related
Error While Adding Dynamic Data To An Existing Web Site - The Method 'Skip' Is Only Supported For Sorted Input In LINQ To Entities. The Method 'OrderBy' Must Be Called Before The Method 'Skip'.
I am creating an web site which will support dynamic data. When I am creating a dynamic web site from Scratch (from template in VS) all is working fine. But when I am trying to add dynamic entity (.edmx) file and running the application I am getting following error

"The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'. "

Posted: Apr 13 10 at 13:11

View 2 Replies!   View Related
Custom Server Controls :: Custom Control Design View Error
I have created a custom control from scratch and it works fine as in you can build the project that uses it and it works fine at runtime. Problem is when you go to design view the control shows an error in the place of where the control should be rendered.

Error: '<SomeValue>' Could not be set to '<SomeProperty>'

This shows up on all my custom set properties. These properties are created as basic as possible. I can give the properties values in Source view and run the app just fine. I can even add a Onclick event. If I don't set any custom properties the control will render fine in Design view. It's only when I set a value to a custom property.

Property Code Example:


I've even removed the Category and Description tags with no difference.

I don't know if what I said makes sens, but I hope it does.

Posted: Aug 13, 2010 10:53 AM

View 3 Replies!   View Related
Custom Server Controls :: Custom Control Design Time SiteMap Provider Error?
I was referred here by MSDN forums hope this is the right place - I have a custom control (:WebControl) that renders web.sitemap in a specific way. While it runs error free and produces the expected result, at Design-Time it complains


and have tried the SiteMapDataProvider Tag with and without theSiteMapProvider
attribute.Does anybody have (a) any experience with this, or (b) any suggestions as to how to track down the problem?

Posted: May 13, 2010 04:28 AM

View 3 Replies!   View Related
C# - Software Design & Web Service Design
I'm about to design my Web service API, most of the functions of my API is basically very simular to my web application. Now the question is, should I create 1 single method and reuse them for both the web application and the web service api? (This seems to be the logical solution, however its very complicated; it's much easier to duplicate the method used by the web application, and keep both separate, ie one method for the web application and one method for the web service.)

1) REUSE: one main method and reuse them for both web application and web service application (I like this but it's complicated)

WebAppMethodX --uses-->
APIMethodX ---uses---->
ie Commonfunctionmethod_x contains reusable set of common features
PRO: less code, less maintenance, less bugs.
CON: very complicated

2) DUPLICATE: two methods, one method for the web application and one method for the web service.

PRO: simple
CON: duplication = more code, more maintenance, more bugs!

Posted: Dec 30 10 at 1:33

View 4 Replies!   View Related
Visual Studio :: Clicking On Design View Button - Error "Microsoft.VisualStudio.Xaml" Has Failed To Load Properly
When clicking on design view button - Received error "Microsoft.VisualStudio.Xaml" has failed to load properly(GUID ={E58C2A8B-BCC4-4559-AD59-D62EB6D58A22}). Possible environment corruption.

Posted: Jan 27, 2011 04:15 PM

View 2 Replies!   View Related
Visual Studio :: Switching To Design View - Unable To See Design View?
in my project the design view is not viewed, but the project is working well and good .. the only issue is i cant see my design view ..

error stated is ""Cannot switch views: Validation (Internet Explorer 6): Element 'Style' cannot be nested within element 'td'.""

Posted: Jan 05, 2010 05:15 AM

View 2 Replies!   View Related
C# - Web Service Design - Error Code (store In Source Code Or Store In Database?
Web service error response (code/message etc) would you store it in a database? or would you keep the error response in a method.By the time I'm done with this, there will be hundreds of error response, maybe in the future, thousands? (I dont know yet, depends how large this web service grows).EDIT: error response is the response returned back to the application via the web service, (not to be confused with error logging).

Posted: Jan 19 at 6:20

View 1 Replies!   View Related
ADO.NET :: Use SP With Linq To Entities?
How to use Stored Procedures with Linq to Entities? I prefer an example with input and output Thevideos on asp.netonly showhow to do this with Linq to SQL.

Posted: Sep 25, 2010 03:28 PM

View 5 Replies!   View Related
Sql To Linq To Entities
I have a simple join:

Users AS U ON A.UserId = U.Id INNER JOIN Businesses AS B ON B.Id = C.BusinessId OR B.UserId = U.Id

how to do this : ON B.Id = C.BusinessId OR B.UserId = U.Id with linq in entity framework.

Posted: May 13, 2010 08:45 PM

View 2 Replies!   View Related
Bind And Action To Two Or More Entities?
Let's say you have a complex html form. Some of the fields will be used to enter data into table 1. Other fields will be used to enter data into table 2, but only if the insertion into table 1 succeeds.

Let's also assume that for whatever reason, you do not wish to split this up into two separate steps, using Session to cache the previous result.

Is it possible to define your action thusly:

public ActionResult DoFooThing(Entity1 e1, Entity2 e2);

Where e1 contains the fields required for the first part of the process and e2 contains the fields for the second?

Will both entities be properly bound?

Note: these entities will have fields unique to them, so that no field is shared between them.

An example of this would be in my forum project. A thread cannot exist without at least one post, so I make the user create the first post when creating the thread. My entity for Thread does not contain a field for Message, as it is not in that table. So I am wondering if I can safely bind my action like this:

// ID is the forum id the new thread is going into public ActionResult CreateThread(int ID, Thread newThread, Post newPost);

Then proceed to attempt to insert the thread, and on success insert the post, rolling back if either fails.

Posted: Oct 15, 2009, 09:54

View 2 Replies!   View Related
MVC :: What E Position Is For Linq To Entities 2 SQL
WHY are all the examples on this site linq to SQL? Did ms not themselvesannounce dropping support for l2SQL over a year ago? i really don't get it. Examples are great.. but really not helping me since i've gone ahead andlistened to MS. And can someoneat MS clarify what the position is for linq 2 SQL.. Is it supported? Recommended? Whatthe hell.

Posted: Jan 27, 2010 08:21 PM

View 7 Replies!   View Related
MVC :: How Domain Entities Are Managed
I'm not sure where to post, but my problems started from and is related to persistence data and domain modelling. So I thought I'd post my question in the SQL Server/database orum.Anyhow I have a few questions:As I read more on building scalable website applications and with advent of ASP.NET MVC and seeing how things are doing from ASP.NET MVC tutorial, it lead me to write application using more and more domain driven design. Firstly, how are domain entities names are managed? For example, we could write a class to model an entity like, cars, and have a class file: Car.cs. Then if we use the ADO.NET Entity Framework (ADO.NET EF) to manage its persistence storage, the Entity Framework too will generate a class name Car

Posted: Dec 23, 2009 09:50 AM

View 1 Replies!   View Related
ADO.NET :: Why 2 Different Entities Reference The Same Object
I useLinq To Entitiesto get 2 objects m1 & m2. And I don't understand why 2 different objects reference the SAMETemplatetable.

I suspect that the reason due to the connection between MConfigOnPage1, MConfigOnPage2 with MConfiguration. Maybe it should be splitted somehow?

Here I attached my ERD and the code.


Posted: Mar 09, 2011 11:23 AM

View 2 Replies!   View Related
ADO.NET :: Editing Entities In M - N Relationship?
I make ASP.NET MVC3 application for spa and I've encoutered problem with M:N relationship. I've got this model Each Insurance Company has different pricing for each patient medical indication, so sample data looks like this:



And I don't know how to make Edit with possibility of changing not only Indication but IC to.

Posted: Feb 19, 2011 07:36 PM

View 1 Replies!   View Related
ADO.NET :: EF Saving Related Entities?
Having the following model Admin and AdminGroup is joined by AdminAdminGroup which has (AdminId, AdminGroupId) fields. When I add a new Admin row AdminGroups are associated with it automatically however this only works on INSERT.When I'm trying to update or associate more AdminGroup's with particualr Admin row (_repo.Update((DataLayer.Admin)row);) only Admin gets updated and no groups are ever modified.What is the correct way of updated "related" entities? so that AdminGroup also get's updated.

Posted: Aug 11, 2010 01:02 PM

View 6 Replies!   View Related
ADO.NET :: Automapping Entities In Nhibernate?
i am having a little problem in mapping all the entities in contained in the namespace "nhibernateTest.Domain" . it basically contains all the Map Classes like , StudentMap, DepartmentMap etc. .. now in case of normal nhibernate what we used to do is :


now what it used to do is . look for all the "*.hbm.xml" files in my namespace and automatically map them...

how to do the same for fluent nHibernate ? so that it looks for all map classes in folder

"nhibernateTest.Domain" ...resolve the namespace "nhibernateTest.Domain"... and automatically map them so that i dont have to create the session separately for diffrent Map classes ?

Posted: Mar 28, 2011 05:34 AM

View 1 Replies!   View Related
DataSource Controls :: Add Entities Using EF?
I have the following admx:

I have to add the (AccData, CntactData, PhnNumber, FnclDetail)entities to the database in one shot

What's the best practices to do the add operation for the above entities??

Posted: Apr 20, 2010 06:33 PM

View 2 Replies!   View Related
ADO.NET :: Generate Id For Set Of Entities When Inserting?
I have I method where I insert muliple records to a SQL Server 2008 database. The table in which the records are inserted has a primarykey integer column with auto increment. The problem is that I have another column called GroupId where I want an integer representing the current insert to be set, i.e. for each time the method gets called a new group id should be generated the group id columnof the records to be inserted should be set to this value. What's the best way to generate this group id? I guess I could do a SELECT MAX(GroupId) + 1FROM Table to generate an idbefore I make the inserts but this won't be a good solution when it comes to concurrency.

Posted: Dec 23, 2010 11:51 AM

View 13 Replies!   View Related
ADO.NET :: Structure The BLL Using LINQ To Entities?
I am trying to learn LINQ to entities, and am working out how to best structure my BLL layer. I have generated the entity model and have created a generic repository in my DAL that returns results as IList<T>. I initially created the BLL to also return

results as IList<T>:

public IList<DAL.Customer> SelectAll()
{ [code]...

Now I am working on the aspx page, and I can create an ObjectDataSource and configure it to use my BLL, but since I am returning IList, I can't sort since I am not using a DataView. I have seen some articles on the web for converting IList to DataView, but that seems like a lot of overhead for every query.My goal is to keep a clean separation between layers without making things overly complicated. I would like to know how others have done this, or maybe a link to a good tutorial that shows how to structure all three layers.

Posted: Nov 10, 2010 12:44 AM

View 8 Replies!   View Related
ToList And Querying Multiple Entities?
I have the following code for the SelectedIndexChanged event of a drop down list. This works fine as it is but this entity has a relationship to another entity (Genre). if i change the select statement to { m, m.Genre.MovieGenre }).ToList(); it doesnt work as contains anonomyous types.


Posted: May 13, 2010, 05:24

View 1 Replies!   View Related
Set A Coding Namespace For Both The Context As Well As The Entities?
I typically don't play with betas, so I am just now getting used to vs 2010 pro. I grabbed it from DreamSpark yesterday, and so far I like all the changes.

I was wondering though, with some of the changes to EF, is there now a way to set a coding namespace for both the context as well as the entities, instead of just setting the custom tool namespace (this wraps both context and entities)? Typically, I like having my classes grouped into namespaces by type, and since a context isn't an entity, it shouldn't go in the entities namespace. note: I am talking about actual coding namespaces, not the conceptual namepsaces used internally by EF.

I was also wondering if having this (the x86 vs 2010 ide) beside my old one (x64 vs 20080 ide) would pose any problems? It seems to be working ok, I just wanted to make sure I hadn't missed announcements saying I had to de-install one before installing the other.

Posted: Apr 15, 2010, 11:47

View 2 Replies!   View Related
Copyright 2005-08, All rights reserved