public static bool RegisterDynamicProperty(IDynamicProperty prop, ContextBoundObject obj, Context ctx)
{
bool fRegistered = false;
if (prop == null || prop.Name == null || !(prop is IContributeDynamicSink))
{
throw new ArgumentNullException("prop");
}
if (obj != null && ctx != null)
{
// Exactly one of these is allowed to be non-null.
throw new ArgumentException(Environment.GetResourceString("Argument_NonNullObjAndCtx"));
}
if (obj != null)
{
// ctx is ignored and must be null.
fRegistered = IdentityHolder.AddDynamicProperty(obj, prop);
}
else
{
// ctx may or may not be null
fRegistered = Context.AddDynamicProperty(ctx, prop);
}
return(fRegistered);
}