Click here to Skip to main content
Rate this: bad
good
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
Tanumay991.7K
Comments
kumar2413 at 20-May-13 22:20pm
   
your question is too general.explain in detail so that we can help you.
Sergey Alexandrovich Kryukov at 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...
—SA
Rate this: bad
good
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.
 

[Table(name="TEmployee")]
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.
Thanks.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 404
1 Nirav Prabtani 338
2 Abhinav S 170
3 PIEBALDconsult 160
4 Dave Kreskowiak 155
0 OriginalGriff 7,580
1 Sergey Alexandrovich Kryukov 6,806
2 Maciej Los 3,919
3 Peter Leow 3,693
4 CHill60 2,742


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 3 Jul 2013
Copyright © CodeProject, 1999-2014
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