Click here to Skip to main content
12,402,889 members (73,491 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET
How can I use the concept of primary key and foreign key concept in class?

pls. help me.
Posted 20-May-13 16:07pm
kumar2413 20-May-13 22:20pm
your question is too general.explain in detail so that we can help you.
Sergey Alexandrovich Kryukov 20-May-13 22:50pm
...and not really related to some particular class; these are the concept or relational model and SQL.
However, I provided a short answer...
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Yes, We make our class property as primary key.
To make the class property as primary key we have to use the following name space:
using System.Data.LINQ.Mapping;
Then we can map our class according to the table.

public class Employee
[Coloumn(IsPrimaryKey=true,Storage="ID", Name="_id")]
public int Id{get;set;}

Thus we can set our class property according to the related Table field.

Thus I can solve.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 3 Jul 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100