/// <summary> /// Initializes static members of the Together class. /// </summary> /// <param name="parentIDName">The name of the field containing the ID in the parent class. Defaults to autodetect.</param> /// <param name="into">The name of the field list of the child objects in the parent class. Defaults to autodetect.</param> public Together(string parentIDName = null, string into = null) { _parentIDName = parentIDName; _into = into; _parentID = ChildMapperHelper.GetIDAccessor(typeof(T), parentIDName).CreateGetMethod <T, Object>(); _listSetter = ChildMapperHelper.GetListAccessor(typeof(T), typeof(TChild), into, setter: true).CreateSetMethod <T, List <TChild> >(); _listGetter = ChildMapperHelper.GetListAccessor(typeof(T), typeof(TChild), into, setter: false).CreateGetMethod <T, ICollection <TChild> >(); }
/// <summary> /// Gets the list setter for the class, looking for an IList that matches the type. /// </summary> /// <returns>An accessor for the ID field.</returns> private static Action <TParent, List <TChild> > GetListSetter() { return(ChildMapperHelper.GetListAccessor(typeof(TParent), typeof(TChild)).CreateSetMethod <TParent, List <TChild> >()); }