No problem....

Here is the map:

    public class ApplicationInformation_Map :
ClassMap<ApplicationInformation>, IMap
    {
        private string _table;

        public string Table
        {
            get { return _table; }
        }

        public ApplicationInformation_Map()
        {
            _table = "ACCOUNT";
            WithTable(Table);
            Id(x => x.Id, "GUID_ACCOUNT_ID");
            Map(x => x.AccountNumber,
"STR_ACCOUNT_NUMBER").Not.Nullable();
            Map(x => x.FirstName, "STR_FIRST_NAME");
            Map(x => x.LastName, "STR_LAST_NAME");
            Map(x => x.MiddleName, "STR_MIDDLE_NAME");
            Map(x => x.Email, "STR_EMAIL_ADDRESS");

            References(x => x.StateInfo, "StateId")
                .WithForeignKey("GUID_STATE").ColumnName("GUID_STATE")
                .FetchType.Join();

            References(x => x.TransactionInfo, "ACCOUNTID")
                .WithForeignKey("STR_ACCOUNT_NUMBER").ColumnName
("STR_ACCOUNT_NUMBER")
                .FetchType.Join();

            HasMany(x => x.Application_List)
                .KeyColumnNames.Add("GUID_ACCOUNT")
                .Inverse()
                .FetchType.Join()
                .Cascade.SaveUpdate();


        }
    }


Here is the entity:

    public class ApplicationInformation : IBusinessEntity
    {

        public virtual Guid Id { get; set; }
        public virtual int AccountNumber { get; set; }
        public virtual Guid StateID { get; set; }
        public virtual string FullName { get; set; }
        public virtual string FirstName { get; set; }
        public virtual string LastName { get; set; }
        public virtual string MiddleName { get; set; }
        public virtual string Email { get; set; }
        public virtual States_Rate StateInfo { get; set; }
        public virtual IList<Application> Application_List { get;
set; }
        //public virtual IList<TransactionScheduled> Transaction_List
{ get; set; }
        public virtual TransactionScheduled TransactionInfo { get;
set; }
        //public virtual Application Application { get; set; }

        public ApplicationInformation()
        {
            StateInfo = new States_Rate();
            Application_List = new List<Application>();
            //Transaction_List = new List<TransactionScheduled>();
            TransactionInfo = new TransactionScheduled();
        }
    }


Here is the SQLite Create Data.....it fails at the Bank creation
                timeZoneTypes = new[]
                {
                    new TimeZones{ Id="C", TimeZoneGMTOffset=6}
                };
                foreach (var type in timeZoneTypes)
                {
                    session.Save(type);
                }

                Guid[] stateGuids = new Guid[2];
                Guid[] accountGuids = new Guid[3];
                Guid[] applicationGuids = new Guid[3];

                int i = 0;

                stateTypes = new[]
                {
                    new States_Rate{ Id=new Guid(), State="TX",
TimeZone="C"}
                };

                foreach (var type in stateTypes)
                {
                    stateGuids[i] = (Guid)session.Save(type);
                    i++;
                }

                accountTypes = new[]
                {

                    new ApplicationInformation {Id=new Guid(),
AccountNumber=11110002, FirstName="1572531072",
                        MiddleName="", LastName="636127353",
Email="[email protected]", StateInfo = new States_Rate()
{Id=stateGuids[0]}},

                    new ApplicationInformation {Id=new Guid(),
AccountNumber=11110009, FirstName="2094372414",
                        MiddleName="", LastName="984775600",
Email="[email protected]", StateInfo = new States_Rate()
{Id=stateGuids[0]}},

                    new ApplicationInformation {Id=new Guid(),
AccountNumber=11110016, FirstName="094372414",
                        MiddleName="", LastName="984775600",
Email="[email protected]", StateInfo = new States_Rate()
{Id=stateGuids[0]}}
                };


                try
                {
                    i = 0;
                    foreach (var type in accountTypes)
                    {
                        accountGuids[i] = (Guid)session.Save(type);
                        i++;
                    }
                }
                catch (Exception ex)
                {
                    string msg = ex.Message;
                }

                applicationTypes = new[]
                {
                    new Application{ApplicationNumber=33330002,
LenderID=5,  AccountID=accountGuids[0]},
                    new Application{ApplicationNumber=33330009,
LenderID=5,  AccountID=accountGuids[1]},
                    new Application{ApplicationNumber=33330016,
LenderID=5,  AccountID=accountGuids[2]}

                };

                i = 0;
                foreach (var type in applicationTypes)
                {
                    applicationGuids[i] = (Guid)session.Save(type);
                    i++;
                }

                bankTypes = new[]
                {
                    new Bank{Id=1, ApplicationID=applicationGuids[0],
BankName="Bank of Somewhere", BankYears=4, BankMonths=10,
                        OutstandingPayDayLoan=0,
DirectDeposit_Flag="Y", RoutingNumber="22223333", Bank_Application=new
Application(){} },
                    new Bank{Id=2,ApplicationID=applicationGuids[1],
BankName="Bank of Nowhere", BankYears=0, BankMonths=8,
                        OutstandingPayDayLoan=0,
DirectDeposit_Flag="Y", RoutingNumber="22223333", Bank_Application=new
Application(){}},
                    new Bank{Id=3,ApplicationID=applicationGuids[2],
BankName="Bank of Anywhere", BankYears=0, BankMonths=8,
                        OutstandingPayDayLoan=0,
DirectDeposit_Flag="Y", RoutingNumber="22223333",
Bank_Application=new Application(){}}
                };
                foreach (var type in bankTypes)
                {
                    session.Save(type);
                }

Thanks for the help
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to