TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ahmed salah
NA
530
148.9k
how to implement migration by changing to identity code firs
Nov 9 2016 6:13 AM
I have class department inside container Containerclass as following
using
System;
using
System.Collections.Generic;
using
System.ComponentModel.DataAnnotations;
using
System.ComponentModel.DataAnnotations.Schema;
using
System.Linq;
using
System.Web;
namespace
UniversityData.Models
{
[Table(
"Department"
)]
public
partial
class
Department
{
public
Department()
{
}
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Key]
public
int
DepartmentID {
get
;
set
; }
[Required]
[StringLength(50)]
public
string
DepartmentName {
get
;
set
; }
[Required]
[StringLength(50)]
public
string
YearName {
get
;
set
; }
}
}
I need to make DepartmentID field identity then apply migrations in database
how to do that
my container class as following
public
partial
class
ContainerClass : DbContext
{
public
ContainerClass() :
base
(
"name=mycon"
)
{
}
public
virtual
DbSet<Department> Departments {
get
;
set
; }
}
Table department already created in database but only i need to modify table
to make DepartmentID IDENTITY then make migrations
Reply
Answers (
1
)
How to start learning Entity Framework
how to bind 3 dropdown values into a textbox in asp.net mvc