예제 #1
0
 /// <summary>
 /// Sets up the default load command for a ManyToMany property
 /// </summary>
 /// <typeparam name="D">Data type</typeparam>
 /// <param name="Property">ManyToMany property</param>
 public void SetupLoadCommands <D>(Mapper.Default.ManyToMany <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} INNER JOIN {2} ON {2}.{1}{3}2={1}.{3} WHERE {2}.{4}{5}=@0" :
                                                    "SELECT {0} FROM {1} INNER JOIN {2} ON {2}.{1}{3}={1}.{3} WHERE {2}.{4}{5}=@0",
                                                    GetColumns(ForeignMapping),
                                                    ForeignMapping.TableName,
                                                    Property.TableName,
                                                    ForeignMapping.IDProperties.FirstOrDefault().FieldName,
                                                    Mapping.TableName,
                                                    Mapping.IDProperties.FirstOrDefault().FieldName),
                                      CommandType.Text);
     }
 }
 /// <summary>
 /// Sets up the default load command for a ManyToMany property
 /// </summary>
 /// <typeparam name="D">Data type</typeparam>
 /// <param name="Property">ManyToMany property</param>
 public void SetupLoadCommands <D>(Mapper.Default.ManyToMany <T, D> Property)
     where D : class, new()
 {
 }