Exemplo n.º 1
0
 private static void CloneProperties(IReadOnlyEntityType sourceEntityType, IMutableEntityType targetEntityType)
 {
     foreach (var property in sourceEntityType.GetDeclaredProperties())
     {
         var clonedProperty = targetEntityType.AddProperty(property.Name, property.ClrType);
         clonedProperty.IsNullable         = property.IsNullable;
         clonedProperty.IsConcurrencyToken = property.IsConcurrencyToken;
         clonedProperty.ValueGenerated     = property.ValueGenerated;
         clonedProperty.SetBeforeSaveBehavior(property.GetBeforeSaveBehavior());
         clonedProperty.SetAfterSaveBehavior(property.GetAfterSaveBehavior());
         property.GetAnnotations().ForEach(annotation => clonedProperty[annotation.Name] = annotation.Value);
     }
 }