Im using EF to update my database.
This is my model:
//Resource
public long ResourceId { get; set; }
public string Name { get; set; }
public string Descritption { get; set; }
public string UserId { get; set; }
public int ResourceTypeId { get; set; }
public byte[] Data { get; set; }
public bool IsEnabled { get; set; }
public bool Approved { get; set; }
public System.DateTime DateCreated { get; set; }
public virtual ICollection<MetaData> MetaDatas { get; set; }
//MetaData
public long MetaDataId { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string LanguageCode { get; set; }
public string UserId { get; set; }
public System.DateTime DateCreated { get; set; }
public virtual ICollection<ResourceMetaList> ResourceMetaLists { get; set; }
public virtual ICollection<Resource> Resources { get; set; }
What is it that makes metadataid increase by 1 everytime i add a new metadata? I want to be able to add metadata with a specific id?
There is a connectiontabl between resource and metadata where the id of each of them connnects them. so i want to be able to add a specific metadata for each resource but for now it gives it a new id everytime so it is not realy the same metadata that connects to each resource but a new one every time.
Edit
Maybe the problem is not how i modeled my database but how i update the database with data? There is a connection table between Resource and MetaData and is that table i want to update rather then the metadata table itself. But the connectiontable doesn't have a model class for it self but i exists in the database. How do i update that table only?
EDIT 2
The 3 arrow point to rows that looks the same, they should all be the same row but be connected to a different resource in the table to the left.