• Ef download
  • Class oluştur (id ver. Class ismi + ID (UrunID))
  • Context class oluştur

              -bu class DbContect class miras almak zorunda

              -class lar dbset

              -connection string oluştur

  • Package manager console aç ve enable-migrations aktif et
  • Configration class AutomaticMicrationsEnable = true
  • Update-database
  • Update-database –force

There is already an object named 'tableName' in the database.

 "Package Manager Console" açarak şu komutları uyguluyoruz.

Add-Migration Initial -IgnoreChanges

Update-Database -verbose


urun.cs

 

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace CFirst.Models
{
public class Demirbas
{
public int DemirbasId { get; set; }

[Required,StringLength(50)]
public string UrunAdi { get; set; }

public string Cinsi { get; set; }
public string Aciklama { get; set; }
public int Omru { get; set; }
public DateTime TeminTarihi { get; set; }
public string AlindigiBolum { get; set; }

}
}


context.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using CFirst.Models;

namespace CFirst.Data
{
public class VeriDBContext : DbContext
{
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
}
public VeriDBContext()
{
Database.Connection.ConnectionString = "Data Source =HABIPYILMAZ\\SQLEXPRESS; Initial Catalog = CFirstMyDB; Trusted_Connection=true;";
}
public DbSet Demirbaslar { get; set; }
}
}

Okul Zil Programı

yilsoftzil

9786059223690
logo5

Esma-ül Hüsna

Ziyaretçi İstatistikleri

Bugün165
Dün421
Bu hafta3291
Bu ay7903
Hepsi840438