RegisterProperty
(PropertyInfo
info)
{
Type objectType = typeof(T);
return RegisterProperty
(objectType, info);
}
protected static PropertyInfo
RegisterProperty
(string name)
{
PropertyInfo
info = new PropertyInfo
(name);
return RegisterProperty(info);
}
protected static PropertyInfo
RegisterProperty
(string name, string friendlyName)
{
PropertyInfo
info = new PropertyInfo
(name, friendlyName);
return RegisterProperty(info);
}
protected static PropertyInfo
RegisterProperty
(string name, P defaultValue)
{
PropertyInfo
info = new PropertyInfo
(name, "", defaultValue);
return RegisterProperty(info);
}
protected static PropertyInfo
RegisterProperty
(string name, string friendlyName, P defaultValue)
{
PropertyInfo
info = new PropertyInfo
(name, friendlyName, defaultValue);
return RegisterProperty(info);
}
3.6.2 throws an exception if you attempt to register a property for a type that's already been used.
That's about as far as I can go, because it is totally legal to register properties for one class from within another class (there's a thread about this that's active right now actually).
In all cases (except CriteriaBase and CslaIdentity subclasses) I recommend people use the proper overload of RegisterProperty() - that doesn't accept the object type:
RegisterProperty<string>(c => c.Name);
or
RegisterProperty<string>(new PropertyInfo<string>("Name"));
Skip the typeof() parameter and let the compiler do the work for you to make sure the right type is being used.
Copyright (c) Marimer LLC