What I have learnt during these months

  1. Using generic type to standardized data flow.

  2. have multiple table needed to be inserted or deleted, Have to use Transaction.

  3. Check Null is super important,both at back end or database.

  4. when SaveChange throws an error. It is because we don’t set the columns for the table to be not null。

  5. Definitely use enum to store constant variable

  6. navigation property make developer’s life much easier because you don’t need to worry about the Joining.

  7. If you want to create the instance of dbcontext, remember to use “using” to release the garbage in memory. It can clean up the memory automatically

  8. soft delete. We will only need to set the active to false instead of deleting it all

  9. set the default value for parameters of a function by using int num = 0.

  10. use factory or Interface to decouple between each layers.

  11. Json(result.Data, JsonRequestBehavior.AllowGet) standard way of passing data to front-end in controller.

  12. If you want to have the id for the record which is just added with ORM-ef, get it after DB.SAVACHANGE().

  13. EF lazy loading (when it is transferred to list. It then generates SQL query)

  14. Don’t use generate SQL in foreach loop, it is disaster.

  15. naming convention is important. Camel case is always good.

  16. Trying to use reflector to read the source code. It will help you with the understanding of CLR.

  17. put partial view into modal is a good idea. use partial view to display a table which needed to updated, your page would not be refreshed.

Social Media


All Posts

Contact Info