Example #1
0
 /// <summary>
 /// Copies the specified mapping.
 /// </summary>
 /// <param name="mapping">The mapping.</param>
 public void Copy(IMapping mapping)
 {
     if (mapping is null)
     {
         return;
     }
     foreach (var prop in mapping.IDProperties.Where(x => !IDProperties.Any(y => y.Name == x.Name)))
     {
         CopyProperty(prop);
     }
     foreach (var prop in mapping.ReferenceProperties.Where(x => !ReferenceProperties.Any(y => y.Name == x.Name)))
     {
         CopyProperty(prop);
     }
     foreach (var prop in mapping.MapProperties.Where(x => !MapProperties.Any(y => y.Name == x.Name)))
     {
         CopyProperty(prop);
     }
     foreach (var prop in mapping.ManyToManyProperties.Where(x => !ManyToManyProperties.Any(y => y.Name == x.Name)))
     {
         CopyProperty(prop);
     }
     foreach (var prop in mapping.ManyToOneProperties.Where(x => !ManyToOneProperties.Any(y => y.Name == x.Name)))
     {
         CopyProperty(prop);
     }
 }
Example #2
0
 /// <summary>
 /// Determines whether the mapping contains a property.
 /// </summary>
 /// <param name="propertyName">Name of the property.</param>
 /// <returns><c>true</c> if the mapping contains the specified property; otherwise, <c>false</c>.</returns>
 public bool ContainsProperty(string propertyName)
 {
     return(IDProperties.Any(x => x.Name == propertyName) ||
            ReferenceProperties.Any(x => x.Name == propertyName) ||
            MapProperties.Any(x => x.Name == propertyName) ||
            ManyToManyProperties.Any(x => x.Name == propertyName) ||
            ManyToOneProperties.Any(x => x.Name == propertyName));
 }