public static void ToPrivate(ref dynamic publicExpression, NamingConventions?conventions, out string defaultColumnName) { var memberExpression = publicExpression.Body as MemberExpression; if (memberExpression == null) { throw new ArgumentNullException("publicExpression.Body"); } defaultColumnName = memberExpression.Member.Name; var finder = PropertyFinderFactory.Create(conventions); var privateProperty = finder.Find(defaultColumnName); var visitor = new ChangePropertyNameVisitor(privateProperty); publicExpression = visitor.Visit(publicExpression); }
public void Should_create_settable_finder_when_behavior_is_all() { var finder = PropertyFinderFactory.Create(For.AllProperties, typeof(object)); Assert.IsTrue(typeof(SettablePropertyFinder) == finder.GetType()); }
public void Should_create_null_finder_when_behavior_is_none() { var finder = PropertyFinderFactory.Create(For.None, typeof(object)); Assert.IsTrue(typeof(NullPropertyFinder) == finder.GetType()); }
public void Should_create_explicit_finder_when_behavior_is_explicit() { var finder = PropertyFinderFactory.Create(For.ExplicitProperties, typeof(object)); Assert.IsTrue(typeof(ExplicitPropertyFinder) == finder.GetType()); }