Than you for your suggestion but that is not so easy, I will investigate as a last resort, but there are many thousands of lines of legacy code, most of it VB6, that cannot be all refactored all at once. At some later stage I would plan to do so, but not initially.
On May 8, 10:04 pm, nadav s <[email protected]> wrote: > can't you change the representation in the DB? > > > > > > On Sat, May 8, 2010 at 3:08 AM, Rickers <[email protected]> wrote: > > Hi all, > > > I have a legacy database that I am trying to implement ActiveRecord > > over. In the shema I have a table of customers and a table of > > addresses. The primary key of the address table is an integer. I am > > trying to map the address(es) in the customer table using the > > BelongsTo attribute as follows: > > > [BelongsTo(Column = "home_address", > > NotFoundBehaviour=NotFoundBehaviour.Ignore)] > > > There are more than one address and not all are compulsory. The shema > > for the customer table has not null specified on all the address > > pointers with a value of zero being the equivalent of no address. The > > shema also does not unclude any foreign keys for these relations. > > > Adding a new customer where an address has not been supplied throws an > > exception "not-null property references a null or transient > > valueAR.Customer.Bus.Entities.Customers.HomeAddress". > > > Is it possible to map this so that a 0 is persisted when no address is > > specified and on retrieval it doesn't fail looking for address 0 or am > > I forced to remove the constraint. > > > Thanks! > > > -- > > You received this message because you are subscribed to the Google Groups > > "nhusers" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<nhusers%[email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/nhusers?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" 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 > athttp://groups.google.com/group/nhusers?hl=en.- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "nhusers" 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/nhusers?hl=en.
