Water Cooler v2 Water Cooler v2 - 14 days ago 5
C# Question

Why is there no implementation for the methods of StructuralObject?

I am looking up methods of the

System.Data.Objects.DataClasses.StructuralObject
in Reflector and I see that there's no implementation for any of the methods.

I understand that some of the methods such as most of the
SetValidValue
overloads have been marked as reserved for future use, as stated by their documentation.

But even the others, such as:

protected internal static bool BinaryEquals(byte[] first, byte[] second);

protected static DateTime DefaultDateTimeValue();

protected internal static byte[] GetValidValue(byte[] currentValue);

protected internal T GetValidValue<T>(T currentValue, string property,
bool isNullable, bool isInitialized)
where T: ComplexObject, new();

protected internal T SetValidValue<T>(T oldValue, T newValue,
string property)
where T: ComplexObject;

protected internal static TComplex VerifyComplexObjectIsNotNull<TComplex>(
TComplex complexObject,
string propertyName)
where TComplex: ComplexObject;


Even these methods have no implementation. Is there something I am missing?

Secondly,
EntityObject
inherits from
StructuralObject
. These methods don't seem to make a lot of sense for an
EntityObject
to have. For example, why would I make this call:

public partial class Address: EntityObject
{
public void SomeMethod()
{
SetValidValue(0); // On what property or field would I be
// setting this value? It doesn't
// seem to belong here.
}
}

Answer

I'm looking at these types in Reflector and all of the methods have an implementation. Most of them are very simple (especially in the SetValidValue) case but there is an implementation.

It sounds like you're loading up a metadata / reference assembly in Reflector. These assemblies contain only the metadata definitions of types and methods but none of the actual code. Try unloading the assemblies and reloading them from a location that will have an implementation. Usually I just use the Open Cache feature of Reflector to do this.

Comments