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 at http://groups.google.com/group/nhusers?hl=en.
