FindById
You can include properties with the query seperated by coma. This method calls FindAll with SingleOrDefault method. FindAll
You can extend search result with DynamicQueryable methods like where, select, skip, orderby,groupby etc. Add
You have 3 options. If entity doesn't have a parent, simply add with repository. Else if entity has parent you must set its parentId or set parents itself. |
Remove
This code will raises an error if entity has child object and relation in the DB doesn't cascade delete. How to delete child object
One-To-Many Relations: Remember to mark parentId property in child entity with [Owner] attribute. Also in setter method of the parent navigation property, set parentId = 0 if value == null. If not, you'll get orphaned entity exception UnitOfWork
You must use UnitOfWork if you want to add, edit or delete. |
Cheatography
https://cheatography.com
Unity Framework Cheat Sheet by mrtgr
This cheat sheet designed for unity custom framework
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment