public void M() { Mapper.CreateMap<SomeObject, SomeOtherObject>(); SomeObject source = new SomeObject {Name = "An Object"}; SomeOtherObject target = new SomeOtherObject {Id = 123}; Mapper.Map(source, target); Assert.AreEqual(123, target.Id); Assert.AreEqual("An Object", target.Name); }
public void M() { Mapper.CreateMap <SomeObject, SomeOtherObject>(); SomeObject source = GetSource(); SomeOtherObject target = GetTarget(); Mapper.Map(source, target); Assert.AreEqual(123, target.Id); Assert.AreEqual("An Object", target.Name); }
public static IView GetViewType(string PropertyValue, SomeOtherObject parentControl) { Assembly assembly = Assembly.GetAssembly(typeof(ViewFactory)); var types = from type in assembly.GetTypes() where Attribute.IsDefined(type, typeof(ViewTypeAttribute)) select type; var objectType = types.Select(p => p). Where(t => t.GetCustomAttributes(typeof(ViewTypeAttribute), false) .Any(att => ((ViewTypeAttribute)att).name.Equals(PropertyValue))); IView myObject = (IView)Activator.CreateInstance(objectType.First(), parentControl); return(myObject); }
MyClass(SomeOtherObject TheObject = null) {
MyClass(SomeOtherObject TheObject) {
public void Initialize(SomeOtherObject dep) { // assign the dependent object to a class-level variable dependentObject = dep; }