R
Richard Collette
Most of the Linq discussion seems to occurr here, there's no Linq specific
discussion area and I didn't get any responses from the IDE area. Hopefully
there's a knowledgeable person here.
The following would be my example classes being created in the DataContext
designer (pseudo, I know these are actually partial classes.)
class BaseClass
{
public long BaseClassId //Primary Key
public string MyProperty
}
class DerivedClass : BaseClass
{
public string AnotherProperty
}
public class AssociatingClass
{
public long BaseClassId
}
When I try to create a 1 to 1 association between AssociatingClass and
DerivedClass, I am not able to pick the primary key property(BaseClassId) for
the DerivedClass.
If I create the association between the AssociatingClass and the BaseClass,
I can pick the primary key property (BaseClassId). However, the property
that is automatically generated for the AssociatingClass is of type BaseClass
and I cannot see a way to specify that the generated property should be of
type DerivedClass.
How can I create an association to a derivied type and map the correct key
properties?
While I am at it, is there any way to specify in the designer that the
parent property (AssociatingClass) should not be generated in the child
class? If you have a child class (ex. an Address) that is associated with a
ton of other parent classes, the child is going to wind up with a lot of
properties cluttering it up (high coupling).
Thank you,
Rich
discussion area and I didn't get any responses from the IDE area. Hopefully
there's a knowledgeable person here.
The following would be my example classes being created in the DataContext
designer (pseudo, I know these are actually partial classes.)
class BaseClass
{
public long BaseClassId //Primary Key
public string MyProperty
}
class DerivedClass : BaseClass
{
public string AnotherProperty
}
public class AssociatingClass
{
public long BaseClassId
}
When I try to create a 1 to 1 association between AssociatingClass and
DerivedClass, I am not able to pick the primary key property(BaseClassId) for
the DerivedClass.
If I create the association between the AssociatingClass and the BaseClass,
I can pick the primary key property (BaseClassId). However, the property
that is automatically generated for the AssociatingClass is of type BaseClass
and I cannot see a way to specify that the generated property should be of
type DerivedClass.
How can I create an association to a derivied type and map the correct key
properties?
While I am at it, is there any way to specify in the designer that the
parent property (AssociatingClass) should not be generated in the child
class? If you have a child class (ex. an Address) that is associated with a
ton of other parent classes, the child is going to wind up with a lot of
properties cluttering it up (high coupling).
Thank you,
Rich