Model First

The Database First Approach provides an alternative to the Code First and Model First approaches to the Micron Data Model. It creates model codes (classes, properties, DbContext etc.) from the database in the project and those classes become the link between the database and business logic.

Steps:

update-micron model-first

//alternative 
update-micron 
//if you don't pass parameters it will execute the last mode you used

Example model

using Micron;
using System;
using System.Collections.Generic;

namespace Data.Models
{
/***CUSTOMER MODEL***/
  [Table("customers")]
 public partial class Customer : IMicron
 {
        [Primary]
        public Int32 CustomerID {get; set;}
        public String CustomerName {get; set;}
        public String ContactName {get; set;}
        public String Address {get; set;}
        public String City {get; set;}
        public String PostalCode {get; set;}
        public String Country {get; set;}
 }
}

After executing the update. Micron will generate and update database tables matching your models.

If you make changes on your model, just run the command and the database will be updated

Last updated