I need a little advice on how to best solve this issue please.
I have Customer, CustomerLocations, SalesOrder, and Invoice entities.
The customer needs to be able to have multiple billing/shipping address, per customer and per location, sort of like an address book. Simple!!
The SalesOrder and Invoice objects need to be able to store these addresses when created. Again, simple!!
Here is the deal though, I don't want to use a foreign key on the salesorder or invoice items, but the actual fields of the address (Line1, Line2, City, State....).
What would be the best way to solve this?
Update
How about this?
Or
and then you could access it like this:
Partial Public Class Customer
Public ReadOnly Property DefaultBillingAddress As Address
Get
Return Locations.First(Function(x) x.IsDefault).BillingAddresses.First(Function(x) x.IsDefault)
开发者_运维技巧 End Get
End Property
Public ReadOnly Property DefaultShippingAddress As Address
Get
Return Locations.First(Function(x) x.IsDefault).ShippingAddresses.First(Function(x) x.IsDefault)
End Get
End Property
End Class
精彩评论