i am trying to map a one table to the other , basic two primary keys. projectid to project id. how do i define that in the xml?
<class name="ProjectExts" table="project_exts" lazy="false"> <id name="ProjectID" column="PROJ_ID"> <generator class="foreign"> <param name="property">NewProjects</param> </generator> </id> <property name="ProjectManagerName" column="PROJ_MGR_NAME" type="String"/> <property name="ConstStatusCode" column="CONST_STAT_CD" type="String"/> <property name="RecStatus" column="REC_STATUS" type="String"/>
and the other table
<class name="NewProjects" table="NEW_PROJECTS" lazy="false"> <id name="ProjExtId" column="PROJ_EXT_PROJ_ID"> <generator class="assigned"/> </id> <property name="Description" column="DESCR" type="String"/> </class>
now the classes are.
[Serializable] [DataContract(Namespace = "")] public class NewProjects {
[DataMember] public string Description { get; set; }
[DataMember] public string ProjExtId { get; set; }
}
and the other is [Serializable] [DataContract(Namespace = "TProDataTransferObjects")] public class ProjectExts { [DataMember] public string ProjectID { get; set; }
[DataMember] public string ProjectManagerName { get; set; }
[DataMember] public string ConstStatusCode { get; set; }
[DataMember] public string RecStatus { get; set; }
}
and in my wcf i am trying to call the service to return the list for me.
[ServiceContract(Namespace = "")] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] [NHibernateContext] [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)] public class NewProject { [OperationContract] public void ViewNewProject() { using (ISession session = NHibernateContext.Current().Session) { IQuery query; query = session.CreateQuery("from ProjectExts where RecStatus IN ('New','Ready To Approve','Ready To Schedule','Scheduled')"); var list=query.List(); }
} }
i am new to nhibernate and i am trying to select to show 4 fields ProjectManagerName , ConstStatusCode , RecStatus , Description
having lots of issues of where to add the mapping and the xml to show all fields.
thanks
|