Intersekcja w Code First

Intersekcja w Code First
K4
  • Rejestracja:prawie 11 lat
  • Ostatnio:ponad 8 lat
  • Postów:113
0

Witam mam pytanie jak w code first skonstruować koncepcję jak w załączniku.

Próbowałem tak, ale niestety cały czas dostaje: Column names in each table must be unique. Column name 'Product_Unit_Product_UnitID' in table 'PRODUCTs' is specified more than once.

Kopiuj
 
public class PRODUCT
{
    public int ProductID { get; set; }
    public string Name { get; set; }
    public string Description { get; set; }
    public decimal Price_Net { get; set; }
    public decimal Price_Gross { get; set; }
    public int Vat { get; set; }
    public decimal Price_Offer_Net { get; set; }
    public decimal Price_Offer_Gross { get; set; }
    public bool Is_Offer { get; set; }
    public bool Is_Lock { get; set; }
    public OFFER Offer { get; set; }
    public ICollection<PRICE_CUSTOMER> Price_Customer { get; set; }
    public int CategoryID { get; set; }
    public virtual CATEGORY Category { get; set; }
    public int BrandID { get; set; }
    public virtual BRAND Brand { get; set; }
    public int StockID { get; set; }
    public virtual STOCK Stock { get; set; }
    public ICollection<PRODUCT_UNIT> Product_Unit_L { get; set; }
    public int Product_UnitID { get; set; }
    public virtual PRODUCT_UNIT Product_Unit { get; set; }

}
Kopiuj
 
public class PRODUCT_UNIT
{
    public int Product_UnitID { get; set; }
    public decimal Converter { get; set; }
    public int Barcode { get; set; }
    public ICollection<PRODUCT> Product_L { get; set; }
    public int ProductID { get; set; }
    public virtual PRODUCT Product { get; set; }
    public int UnitID { get; set; }
    public virtual UNIT Unit { get; set; }

}

Spotkał się ktoś z czymś takim?

S7
  • Rejestracja:około 12 lat
  • Ostatnio:ponad 5 lat
  • Postów:287
0

czy nie powinno być?

Kopiuj
public virtual ICollection<PRODUCT_UNIT> Product_Unit_L { get; set; }
massther
  • Rejestracja:ponad 16 lat
  • Ostatnio:około 9 lat
0

dlaczego w PRODUCT masz:

public ICollection<PRODUCT_UNIT> Product_Unit_L { get; set; }
public int Product_UnitID { get; set; }
public virtual PRODUCT_UNIT Product_Unit { get; set; 

a w PRODUCT_UNIT

public ICollection<PRODUCT> Product_L { get; set; }
public int ProductID { get; set; }
public virtual PRODUCT Product { get; set; }

pokaż struktury tabel i relacje między nimi, albo co chcesz uzyskać, bo jakiś bug w koncepcji czuję

somekind
Powiązania, nie relacje. :)

Zarejestruj się i dołącz do największej społeczności programistów w Polsce.

Otrzymaj wsparcie, dziel się wiedzą i rozwijaj swoje umiejętności z najlepszymi.