Beispiel #1
0
 private void GuardForDuplicateReferenceMap(ReferenceMap <T> result)
 {
     if (References.Any(p => p.Name.Equals(result.Name)))
     {
         throw new ArgumentException($"Duplicate mapping for reference property {result.Name} detected.");
     }
 }
Beispiel #2
0
        protected virtual IReferenceMap <T> ReferenceMap(Expression <Func <T, object> > expression)
        {
            var propertyInfo = ReflectionHelper.GetProperty(expression) as PropertyInfo;
            var result       = new ReferenceMap <T>(propertyInfo, Identity);

            GuardForDuplicateReferenceMap(result);
            References.Add(result);
            return(result);
        }