/// <summary>
 /// Set DefaultValueSql for sepecific property name and type
 /// </summary>
 /// <param name="modelBuilder"></param>
 /// <param name="propertyName">Name of property wants to set DefaultValueSql for</param>
 /// <param name="propertyType">Type of property wants to set DefaultValueSql for </param>
 /// <param name="defaultValueSql">DefaultValueSql like "NEWSEQUENTIALID()"</param>
 public static void AddDefaultValueSqlConvention(this ModelBuilder modelBuilder, string propertyName, Type propertyType, string defaultValueSql)
 {
     foreach (IMutableEntityType entityType in modelBuilder.Model.GetEntityTypes())
     {
         IMutableProperty property = entityType.GetProperties().SingleOrDefault(p => p.Name.Equals(propertyName, StringComparison.OrdinalIgnoreCase));
         if (property != null && property.ClrType == propertyType)
         {
             property.SetDefaultValueSql(defaultValueSql);
         }
     }
 }
        /// <summary>
        /// Set NEWSEQUENTIALID() sql function for all columns named "Id"
        /// </summary>
        /// <param name="modelBuilder"></param>
        /// <param name="mustBeIdentity">Set to true if you want only "Identity" guid fields that named "Id"</param>
        public static void AddSequentialGuidForIdConvention(this ModelBuilder modelBuilder)
        {
            const string defaultValueSql = "NEWSEQUENTIALID()";

            foreach (IMutableEntityType entityType in modelBuilder.Model.GetEntityTypes())
            {
                IMutableProperty property = entityType.GetProperties().SingleOrDefault(p => p.Name.Equals("Id", StringComparison.OrdinalIgnoreCase));
                if (property != null && property.ClrType == typeof(Guid))
                {
                    property.SetDefaultValueSql(defaultValueSql);
                }
            }
        }
 protected virtual void ConfigureProperty(IMutableProperty property, string configuration, string value)
 {
     switch (configuration)
     {
         case "DefaultValue":
             property.SetDefaultValue(int.Parse(value));
             break;
         case "DefaultValueSql":
             property.SetDefaultValueSql(value);
             break;
         case "ComputedColumnSql":
             property.SetComputedColumnSql(value);
             break;
         case "SqlServerValueGenerationStrategy":
             property.SetValueGenerationStrategy(SqlServerValueGenerationStrategy.IdentityColumn);
             break;
         default:
             throw new NotImplementedException();
     }
 }
        /// <summary>
        /// Set DefaultValueSql for sepecific property name and type
        /// </summary>
        /// <param name="modelBuilder"></param>
        /// <param name="propertyName">Name of property wants to set DefaultValueSql for</param>
        /// <param name="propertyType">Type of property wants to set DefaultValueSql for </param>
        /// <param name="defaultValueSql">DefaultValueSql like "NEWSEQUENTIALID()"</param>
        public static void AddDefaultValueSqlConvention(this ModelBuilder modelBuilder, string propertyName, Type propertyType, string defaultValueSql)
        {
            foreach (IMutableEntityType entityType in modelBuilder.Model.GetEntityTypes())
            {
                //IMutableProperty property = entityType.GetProperties().SingleOrDefault(p => p.Name.Equals(propertyName, StringComparison.OrdinalIgnoreCase));
                //if (property != null && property.ClrType == propertyType)
                //    property.Relational().DefaultValueSql = defaultValueSql;

                #region My Method
                //var property = entityType.FindPrimaryKey().Properties.SingleOrDefault();
                //if (property != null && property.ClrType == propertyType)
                //    property.SetDefaultValueSql(defaultValueSql);
                #endregion My Method

                IMutableProperty property = entityType.GetProperties().SingleOrDefault(p => p.Name.Equals(propertyName, StringComparison.OrdinalIgnoreCase));
                if (property != null && property.ClrType == propertyType)
                {
                    property.SetDefaultValueSql(defaultValueSql);
                }
            }
        }