MVC :: Compound Primary Keys In DB Design?

Mar 2, 2010

I'm getting up to speed with MVC. In all examples that I find, the database tables always seem to have a single autoincrement column as the key. Is this the standard for DB Design when the intent is to use MVC or can MVC cope with compound primary keys that dont necassarily have autoincrement?

Typical DB Design:


It's just that obviously in the real world many companies already have a good DB design populated with data based on the classic design style. If I get clients contemplating updating their applications and want to use the MVC framework, will they also need to consider the redesign of the DB?

If MVC can cope with compound key's are there any good examples. I thought that by using binding exclude/include that compound keys are possible, but it wasn't clear to me.

View 1 Replies

Similar Messages:

Web Forms :: Pass Auto Numbered Primary Keys?

Mar 15, 2010

I have two tables customers and sales . I have a formview that inserts to customers (new customers). I want every time I insert a new customer automatically redirect to another page where I will make a sale. On table sales I have a column CustomerID which I want to automatically take the auto numbered CustomerID from Customers table.

View 2 Replies

SQL Server :: Is It Possible One Foreign Key Referenced By Two Primary Keys From Different Tables

Dec 15, 2010

i'll make a simple website. in my website i have two kind of products to sell

1. Projects

2. Documents

These Tables are available in my database :


now i will make an order table. should i make differentt order table?

or i could save order information of both tables in one table?

View 6 Replies

DataSource Controls :: Using Views With EntityFramework Is Not Able To Recognize Primary Keys

May 2, 2010

Cannot seem to find a good fit for my question so I will ask here.

Does Asp.Net 4.0 solve the problems with using Views with EntityFramework is not able to recognize primary keys.

View 2 Replies

DataSource Controls :: Error 3033 : Their Primary Keys May Collide

Jan 15, 2010

I have started my new mvc project with entity framework,Must say it is very diffcult to work with entity framework.

"I am trying to create new custom entity in .edmx file,Now i have made one column as Entity key,Which is already entity key another entity set."

"Error 3033: Problem in Mapping Fragment starting at line 3081: EntitySets 'Entityset name' and 'Entityset name' are both mapped to table 'Entityset name'. Their Primary Keys may collide."

View 8 Replies

Entity Framework - Dynamic Data IS Showing Primary Keys For Every Table When Using Entities

Feb 4, 2010

Using a very run-of-the-mill database, with identity int for primary keys, a Dynamic Data Entities Project (EntityFramework) displays the primary key for view and edit. When using Linq to Sql, the primary key fields are not displayed.

I would like to hide the primary keys and use Entity Framework (VS 2008, .Net 3.5 sp1).

View 1 Replies

Forms Data Controls :: Compare Integer Value To Primary Keys Of A Detailsvew Datasource?

Mar 8, 2010

I have a textbox that takes an integer value, and a submit button that when clicked passes the value to a detailsview to display the database record at that index.

What I'd like to do is, when the button is clicked, compare the number to the keys in the detailsview's datasource so that if the record ID doesn't exist, I can display a label telling the user that the ID# doesn't exist.

How would I go about doing this? Is there some sort of compare method for the datakeynames property?

View 6 Replies

Forms Data Controls :: Deleting A Record On A File With Multiple Keys / Access The Rest Of The Keys?

Feb 8, 2010

I have a DataGrid that I need to be able to use to delete records form a file



I use


To access the data in the Grid for updating, but it doesn't work for deleting

I can use

string id = GridMenuOptions.DataKeys[e.RowIndex].Value.ToString();

but that only returns the first key.

How do I access the rest of the keys?

View 9 Replies

Configuration :: Web.config AppSettings - Keys Referencing Other Keys?

Dec 7, 2010

My current project has many peripheral systems and many different environments (testing, integration, development etc). As expected, we're using .config files to dynamically manage everything.

Instead of updating each relavant key when deploying to an environment, I was hoping there was a way to change 1 key only. Such as:

<add key="Environment" value="Development"/>

<add key="WebServiceLocation" value="http://<<Environment>>/text.asmx"/>

I've done some searching and haven't come up with an elegant solution. I'm aware that .config files can make use of system variables, but this seems like a bit of a high wire act.

View 2 Replies

Forms Data Controls :: Values From Multiple (non Primary And Primary) Datakeys?

Mar 6, 2011

I have the following gridview (ID=Gridview1)

I have added pid (primary key), chkblood,chkurine,chkstool,chkmalaria as datakeynames.

what I want to pull off here is .... when I click select I'll be redirected to this wizard


I did I want to hide / skip steps in the wizard depending on the condition of checkboxes (chkblood, chkurine,chkstool,chkmalaria)

but I cant get the value from these non-primary datakeynames...

View 2 Replies

How To Make Rich / Compound Views

Feb 7, 2010

I have recently started to examine mvc. I have studied quite a few examples and common to these are that they contain quite simple scenarios, where a view will map to either an instance of a type in the model or a list of a paritcular type from the model.

I'm looking for guidelines to compose/composite views. In the long term I would like Ajax to be part of the equation, but for now I'm looking for a simpler non Ajax setup.

The problem:

Here is a description of a contrieved problem. A domain model contains the types A and B.

class A
{ String ID, String Name, int Age
List<B> ListOfB
class B
{ String ID, String Name, String Url}


Since the solution has to allow for different combinations of data and functionality, I think it would be smart to have a parent view (not to be confused with a masterpage) that contained placeholders for parital views. Then, the parent views controller could make up the right combinations of model data and partial views and feed these to the parent view.

Finally; the questions:

Is my way of thinking in accordance with the mvc methodology? Can you explain/show (not necessarily all of it) how the controller can compile the right combination of partial views and feed these to the parent view?

View 1 Replies

DataSource Controls :: How To Implement Compound From In Linq Using Dbml

Jan 8, 2010

i have some confusion using compund from in linq.I know the concept of compound from but in database table how can we use.can anyone give me example of it.

View 3 Replies

SQL Server :: Calculate A Compound Interest For Each Row Based On The Previous Row?

Sep 12, 2010

I would like to calculate a compound interest for each row based on the previous row.

My table Table1 :

index sum quantity sum_after_interest
1 100 5 500(??)
2 500(??) 2 1000 (??)
3 1000(??) 3 3000 (??)

I marked in question marks the columns that I want to calculate, where I only have the sum for the first row and the quantity for all the rows.

Can this be done using views and inner joins or nested selects ?

View 1 Replies

MVC :: Compound View Model Object Causing Remote Validation Failure?

Feb 12, 2011

I have used a pattern of compound view models for a few of the forms in this project. It works very well.

In this case I have a VendorAddress view model. I use Address(es) in a few places in this project so I made and Address view model object that I can re-use. Then I desided I want to do a very thorough checking of the state codes and zips so, I desided I would try to use remote validation and check the state and zip code aganst a stored set of tables in the database.

The problem is I am not getting values back to the remote action methods for the fields I'm asking for (in this case State and PostalCode). I believe this is because of the name mangleing that the MVC framework does for compound or sub types for id(s) for the inputs in this case it is making names like 'Address_Line1' and 'Address_State' and 'Address_PostalCode'.

Ultimately the question I have is, is there a way of turning off the pre-pended 'Address_' from the base view model object in a way that MVC framework can put it bak into the object after ther post of the form?


Then in the form after rendering it looks like this:


I get the remote call but there is nothing in the parameters "State" and "PostalCode", so the unobtrusive routines are firing but I think it does not know where to look for the data even though I have type something in the mensioned fields. As you can see in the rendered code the id="Address_State" and the data-val-remote-additionalfields="*.State,*.PostalCode"

View 4 Replies

C# - Exception (missing Primary Key) In The Line Of Using Find() Method "Table Doesn't Have A Primary Key"

Aug 25, 2010

i get the following exception (missing primary key) in the line of using Find() method "Table doesn't have a primary key." I've rechecked the Database and all Primary Key columns are set correctly.

DataTable dt = p.GetAllPhotos(int.Parse(Id));
DataTable temp = new DataTable();
temp = dt.Clone();
temp = (DataTable)(Session["currentImage"]);
DataTable dtvalid = new DataTable();
dtvalid = dt.Clone();
DataRow[] drr = new DataRow[1];
drr[0] = dt.Rows.Find((int.Parse(temp.Rows[0]["photoId"].ToString()))+1);
foreach (DataRow dr in drr)

View 1 Replies

SQL Server :: Mobile Number Is Assigned As A Primary Key Showing Error "Primary Key Violation"?

Nov 27, 2010

In the database one number like a 91-9685748596 and, 2nd number like 9122-9685748596 and another one is 9685748596 .when we are try to formate it using substring function it all are may be9685748596,9685748596,9685748596.Mobile number is assigned as a primary its showing error "Primary key violation".We can not the remove primary key also and there are 50 lack data in our database.

View 6 Replies

Data Controls :: Slow Loading Page In Primary Key For Next Loaded Data - Primary Key Not Show Properly

May 7, 2015

I am working on lazy loading page the problem is

when i bind first time page (10) records then primary properly bind with records and when my next 10 records load using lazy loading then the primary key not change it shows 1st records primary key

check the below code in which i am assigning assetid (primary key) but its not assigning properly...

function OnSuccess(response) {
var xmlDoc = $.parseXML(response.d);
var xml = $(xmlDoc);
pageCount = parseInt(xml.find("PageCount").eq(0).find("PageCount").text());
var customers = xml.find("AssetSummary");


View 1 Replies

Visual Studio :: Design View Is Not Able To Pull In The Application For Design?

Feb 23, 2010

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.

View 1 Replies

Why Rad Controls Design Is Not Visible At Design Time In Solution

Feb 27, 2011

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'

View 2 Replies

C# - Software Design & Web Service Design

Dec 30, 2010

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!

View 4 Replies

Visual Studio :: Switching To Design View - Unable To See Design View?

Jan 5, 2010

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'.""

View 2 Replies

Can Function Keys Be Used In A Web Application

Mar 29, 2011

Can function keys be used in a Web application? If so, how

View 1 Replies

How To Use Google Maps Without API Keys

Feb 2, 2010

I am developing a cms that will use more than one domain and i have to use only one google map script in my page. Is there a way to use google maps without api key? Otherwise it's not working?

View 4 Replies

MVC :: ModelBinding With Foreign Keys?

Feb 22, 2011

I have an MVC3 with EF4 project. I have a screen for order .Order has 2 id's inside it for Billilng and Shipping AddressID .When I go and create a new order these fields render as single textboxes as Ids'Question is how can I render full address textboxes (addressline1,city,state,zip etc) do I have drop in the html markup for them? In that case while capturing the data back I willl have to go with classic way of retrieving name/value pair and then do insert into address bring back that identity and update the order record...?

Create(int customerID,FormCollection fc){}

So the main question is how can I do ModelBinding with foreign keys?

View 8 Replies

Web Forms :: Changing The Debugging Keys In Vs?

Apr 27, 2010

is it possible to change my debuging kyes instead of function keys..

because am using the laptop and always i have to press "fn" key to prss the f10 or f11

is there any solution ..or can i permanantly press the fn click event ?

View 1 Replies

Copyrights 2005-15, All rights reserved