/// <summary> /// Sets up the default load command for a map property /// </summary> /// <typeparam name="D">Data type</typeparam> /// <param name="Property">Map property</param> public void SetupLoadCommands <D>(Mapper.Default.Map <T, D> Property) where D : class { if (string.IsNullOrEmpty(Property.LoadCommand)) { IMapping ForeignMapping = Property.ForeignMapping; Property.SetLoadUsingCommand(string.Format(CultureInfo.CurrentCulture, ForeignMapping.TableName == Mapping.TableName ? "SELECT {0} FROM {1} AS {1}2 INNER JOIN {2} ON {2}2.{3}={1}.{4} WHERE {2}2.{5}=@0" : "SELECT {0} FROM {1} INNER JOIN {2} ON {2}.{3}={1}.{4} WHERE {2}.{5}=@0", GetColumns(ForeignMapping), ForeignMapping.TableName, Mapping.TableName, Property.FieldName, ForeignMapping.IDProperties.FirstOrDefault().FieldName, Mapping.IDProperties.FirstOrDefault().FieldName), CommandType.Text); } }
/// <summary> /// Sets up the default load command for a map property /// </summary> /// <typeparam name="D">Data type</typeparam> /// <param name="Property">Map property</param> public void SetupLoadCommands <D>(Mapper.Default.Map <T, D> Property) where D : class, new() { }