Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Employee
- {
- public long Id { get; set; }
- public string Forename { get; set; }
- public string Surname {get; set; }
- public string FullName { get { return Forename + " " + Surname; }}
- }
- <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
- namespace="Domain.Entities"
- assembly="Domain">
- <class name="Employee" table="`Employee`">
- <id name="Id" column="Id" type="long">
- <generator class="identity"/>
- </id>
- <property name="Forename"/>
- <property name="Surname"/>
- </class>
- </hibernate-mapping>
- public Employee GetByFullName(string fullName)
- {
- return _session
- .CreateCriteria<Employee>
- .Add(Restrictions.Eq("FullName", fullName))
- .List<Employee>();
- }
- <property name="Fullname" formula="Forename + ' ' + Surname"/>
- public virtual string Fullname {
- get { return Forename + " " + Surname; }
- set { } // do nothing
- }
Add Comment
Please, Sign In to add comment