Click here to Skip to main content
15,884,237 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI is there any reason why I get this error. I really searched this site before posting this question. I commented out some of my earlier tries.

What I implemented is Many to One connection. So, PersonAccount has a BankId column (FK), while Bank knows nothing about PersonAccount. There is FK constraint implemented on database level.

C#
public BankMap()
        {
            Table("Bank");
            Not.LazyLoad();
            Id(x => x.Id).Column("BankId").GeneratedBy.Sequence("BANK_SEQ");
            Map(x => x.BankName);
            HasMany(x => x.PersonAccounts).KeyColumn("BANKID").Cascade.All();

            //HasMany(x => x.PersonAccounts).KeyColumn("BANKID").Cascade.All().Inverse();
            //HasMany(x => x.PersonAccounts).KeyColumn("BANKID").Cascade.All().None();
       //     HasMany(x => x.PersonAccounts)
       //.Cascade.AllDeleteOrphan()
       //.KeyColumn("BANKID");

        }

public PersonAccountMap()
        {
            Table("PersonAccounts");
            Not.LazyLoad();
            Id(x => x.Id).Column("AccountId").GeneratedBy.Sequence("PERSONACCOUNTS_SEQ");
            Map(x=>x.PersonName);
            References(x => x.Bank, "BANKID");

            //References(x => x.Person, "PERSONID").Cascade.None();

        }

Hope you'll be able to help me.

Thanks
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900