如何在.Net类中使用主键和外键概念的概念? [英] How can I use the concept of primary key and foreign key concept in .Net class?
本文介绍了如何在.Net类中使用主键和外键概念的概念?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在课堂上使用主键和外键概念的概念?
请愿。帮助我。
How can I use the concept of primary key and foreign key concept in class?
pls. help me.
推荐答案
是的,我们将我们的类属性作为主键。
要将类属性作为主键,我们必须使用以下名称空间:
使用 System.Data.LINQ.Mapping ;
然后我们可以根据表格映射我们的类。 br $> b $ b
[表(名称=TEmployee)]
公共课员工
{
[Coloumn(IsPrimaryKey = true,存储=ID,姓名=_ id)]
public int Id {get; set;}
}
因此我们可以根据相关的Table字段设置我们的class属性。
因此我可以解决。
谢谢。
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.
请参阅:
http://en.wikipedia.org/wiki/Primary_key [< a href =http://en.wikipedia.org/wiki/Primary_keytarget =_ blanktitle =New Window> ^ ],
http://en.wikipedia.org/wiki/Referential_integrity [ ^ ],
http ://en.wikipedia.org/wiki/Foreign_key [ ^ ]。
-SA
Please see:
http://en.wikipedia.org/wiki/Primary_key[^],
http://en.wikipedia.org/wiki/Referential_integrity[^],
http://en.wikipedia.org/wiki/Foreign_key[^].
—SA
这篇关于如何在.Net类中使用主键和外键概念的概念?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文