日期:2014-05-18 浏览次数:20973 次
<?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="MyHibernate.Model" assembly="Model"> <class name="MyHibernate.Model.User" table="Users"> <id name="Id"> <generator class="native"></generator> </id> <property name="UserName"></property> <property name="Pwd"></property> <property name="CreateDate"></property> <property name="Power"></property> </class> </hibernate-mapping>
public class UserRepository:BaseRepository<User> { public IList<User> GetAllUser() { return _sessionFactory.Session().CreateQuery("from User").List<User>(); } }