Articles {get;set;}
}
I'd like to set up a tagging system for an entity in order to get a many to many relationship
How is it possible achieve this sort relationship in abp?
Using a tag entity, an article entity and between them...? should i create another entity like "artcicles_tags"?
Must this middle entity be derived from "Entity<long>" as well?
and the mapping configuration is by convention or i must mapping it manually?
Could you give me some clues? some suggestion?
2 Answer(s)
-
0
Have a look at Entity Framework.
You can pretty much use either. If you just want Many to Many relationship, thats possible by just creating your Entities the right way:
public class Article: Entity { public long Id {get;set;} ... public virtual ICollection Tags {get;set;} } public class Tag: Entity { ... public virtual ICollection
This should work. (EF creates your tables)
But if you want your relationship table to have additional fields (ie. CreationDate) you need to use FluentApi.
See this document for help: <a class="postlink" href="http://www.entityframeworktutorial.net/code-first/configure-many-to-many-relationship-in-code-first.aspx">http://www.entityframeworktutorial.net/ ... first.aspx</a>
-
0
oh thanks a lot
i did it quickly and easily-
Added the navigation properties
-
Add-Migration
-
Update-Database
and it's done, nice.
-