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.

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.

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?

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 have this 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 to this 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!

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|service|persistance|domain

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|service|domain

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; }[code]....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.

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.

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?

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.**

I'm trying to use 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 "AjaxControlToolkit.properties.Resources.resources" 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 error suggests 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'm using Visual Studio 2008 on Windows 7 and I'm using the 3.5 files from Codeplex (AjaxControlToolkit.Binary.NET35.zip) targetting .NET Framework 3.5.

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

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.

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 white background and black print.

I am creating an Asp.net 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'. "

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:

[Code]....

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

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

[Code]....

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

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-->COMMONFUNCTIONMETHOD_XAPIMethodX ---uses---->COMMONFUNCTIONMETHOD_Xie Commonfunctionmethod_x contains reusable set of common featuresPRO: 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.

WebAppMethodXAPIMethodXPRO: simpleCON: duplication = more code, more maintenance, more bugs!

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).

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.

WHY are all the examples on this site linq to SQL? Did ms not themselves announce 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 and listened to MS. And can someone at MS clarify what the position is for linq 2 SQL.. Is it supported? Recommended? What the hell.

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

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:

ICIndicationPatientIC1Indication1Patient1Patient2Indication2Patient3

[Code]....

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

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.

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 :

[Code]....

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 ?

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 primary key 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 column of 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) + 1 FROM Table to generate an id before I make the inserts but this won't be a good solution when it comes to concurrency.

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.

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.

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 ado.net 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.