public static IsReverseUpdateWithChildReferencingParent ( |
||
update | ||
Результат | bool |
public static bool IsReverseUpdateWithChildReferencingParent(UpdateOperation update)
{
var ownerPropMeta = update.OwnerPropertyMetadata;
if (null == ownerPropMeta)
{
return false;
}
if (!ownerPropMeta.HasAttribute<OneToManyAttribute>()
&& !ownerPropMeta.HasAttribute<OneToOneAttribute>())
{
return false;
}
var valueMeta = update.ValueMetadata;
if (valueMeta.IsReferenceData
&& valueMeta.HasUpdateableForeignKeys)
{
return true;
}
return ownerPropMeta.HasAttribute<ReferenceDataAttribute>()
&& ownerPropMeta.GetAttribute<ReferenceDataAttribute>().HasUpdateableForeignKeys;
}
}
private static void AppendUpdateCommand(Script script, UpdateCommand command, ref int paramIndex) { if (ReverseUpdateHelper.IsReverseUpdateWithChildReferencingParent(command.Operations.First())) { AppendReverseUpdateCommandForChildTableReferencingParent(script, command, ref paramIndex); } else { AppendStandardUpdateCommand(script, command, ref paramIndex); } }