i have problem when try make fk reference. mappingexception
nhibernate.mappingexception: not determine type for: jps.internal.domain.model.user, > jpscore, version=1.0.0.0, culture=neutral, publickeytoken=null, columns: nhibernate.mapping.column(deptorssoid)
my entities looks this
public class payexagreement : entitybase { public int subscriptionnumber { get; set; } public user deptorsso { get; set; } public string payexagreementref { get; set; } public string payexmaskednumber { get; set; } public string payexpaymentmethod { get; set; } public datetime payexpaymentmethodexpiredate { get; set; } public ilist<subscriptionorder> subscriptionorderlist { get; set; } } public class user : entitybase { public guid ssoid { get; set; } public string ssoemail { get; set; } public contact contact { get; set; } }
and mappingfile payexagreement
public class payexagreementmap : entitybasemap<payexagreement> { public payexagreementmap() { map(x => x.payexagreementref).column("payexagreementref").customtype("ansistring").length(50).not.nullable(); map(x => x.payexpaymentmethod).column("payexpaymentmethod").customtype("ansistring").length(50).not.nullable(); map(x => x.payexmaskednumber).column("payexmaskednumber").customtype("ansistring").length(50).not.nullable(); map(x => x.payexpaymentmethodexpiredate).column("payexpaymentmethodexpiredate").not.nullable(); hasmany(x => x.subscriptionorderlist).keycolumn("payexagreementref").propertyref("payexagreementref").asbag().not.lazyload().cascade.none(); references(x => x.deptorsso).column("deptorssoid").propertyref("ssoid").not.nullable().cascade.none();
and tablesql
create table [dbo].[payexagreement] ( [id] int not null identity(1,1), [deptorssoid] uniqueidentifier not null, [payexagreementref] varchar(50) not null, [payexmaskednumber] varchar(50) not null, [payexpaymentmethod] varchar(50) not null, [payexpaymentmethodexpiredate] datetime not null, constraint [pk_payexagreement] primary key clustered ([id] desc), constraint [fk_payexagreement_user] foreign key ([deptorssoid]) references [user]([ssoid]) on delete no action on update no action);
i can't figure out why nhibernate doesn't recognize type (guid) of column. think problem when try make foreign key reference, solution escapes me.
edit!! here mapping user class
public class usermap : entitybasemap<user> { public usermap() { map(x => x.ssoemail).column("email").customtype("ansistring").not.nullable(); map(x => x.ssoid); references(x => x.contact).column("contactid").cascade.saveupdate(); } }
Comments
Post a Comment