如何在n-hibernate Forward Engineering中设置Annotation [英] How can I set Annotation in n-hibernate Forward Engineering

查看:51
本文介绍了如何在n-hibernate Forward Engineering中设置Annotation的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Java中,我可以轻松设置注释

,例如

In Java I can easily set an annotation
as for example

@Entity
Class User
{
String name;
...//geter
...//seter
}



这里 @Entity 是一个注释

我可以创建一个表名User和用户设置为@Entity注释。



类似地,我怎样才能将ac#class设置为Entity。意味着如何为一个类制作一个 @Entity 注释?

请帮助我。

如果有任何身体知道的话,请告诉我,n-Hibernate中的正向工程是否有任何注释用途?


Here @Entity is an annotation
I can be able to create a table name User and as User is set as @Entity annotation.

Similarly how can I able to set a c# class as Entity. Means How I make an @Entity annotation for a class?
kindly help me.
Also if any body know ,kindly tell me ,is there any annotation use for forward engineering in n-Hibernate?

推荐答案

使用System.Data.LINQ.Mapping;

然后我们可以根据表格映射我们的班级。





[表(名称=TEmployee)]

公共班级员工

{

[Coloumn(IsPrimaryKey = true,存储=ID,姓名=_ id)]

public int Id {get; set;}

}



因此我们可以设置注释或设置我们的类属性根据c#中的表字段
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 annotation or set set our class property according to table field in c#


这篇关于如何在n-hibernate Forward Engineering中设置Annotation的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆