The way I was seeing it, GetEntityRefAssociations is iterating over
all public properties, including the ones that are EntitySets, and the
fact that a property like nwind.Customers.Orders has an
AssociationAttribute throws it off because we can't know if the
associated field is an EntityRef<> until we find its column name. And
since that isn't there for the EntitySet we're iterating over, that's
where the exception is coming from.

On Sep 15, 12:19 pm, "Pablo Iñigo Blasco" <[EMAIL PROTECTED]> wrote:
> Hi Mattew!
>
> On Mon, Sep 15, 2008 at 5:55 PM, Matthew Snyder <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > Looks great so far! I did notice on Oracle and MySQL a decent amount
> > of queries now fail because, for example, the MS SQL Northwind.cs will
> > create a backing field for an association on, say,
> > nwind.Customer.Orders ([Association ... Storage = "_Orders" ...) and
> > many other mapping files don't have this yet, leading to an exception
> > when we try to set field to null.
>
> mmm that's strange because nwind.Customer.Orders is an EntitySet property.
> Look at the following piece of code:
>
> > let field = type.GetField(associationAttribute != null ?
> > associationAttribute.Storage : string.Empty, BindingFlags.NonPublic |
> > BindingFlags.Instance)
>
> Such piece of code is located in DataMapper.GetEntityRefAssociations(Type)
> and it isn't used for EntitySet properties (like nwind.Customers.Orders) but
> for EntityRef properties.
>
> I mean, the Association.Storage info is only needed for EntityRef but not
> for EntitySets properties.
> Look at the oracle-nwind.Order.Employee property, the association attribute
> contains the Storage field="_employee", so it should work fine even in
> oracle.
>
> nwind.Customer.Order association attribute doesn't contains the Storage
> field, but it isn't needed by the DataMapper.GetEntitySetAssociations(Type)
> at least for the moment.
>
> Nonetheless the change looks fine.
>
> Regards.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DbLinq" 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/dblinq?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to