enable-migrations -ContextTypeName Contex -MigrationsDirectory ContexMigrations
Add-migration -configuration MVC.ContexMigrations.Configuration Initial
Update-database -configuration MVC.ContexMigrations.Configuration
public IEnumerable<Book> GetBooks(int id)
{
var books = db.Books.Where(x => x.BookId > id).ToList();
return books;
}
public class Card
{
public int CardId { set; get; }
public Record Record { set; get; }
}
public class Record
{
public int RecordId { set; get; }
}
modelBuilder.Entity<Card>()
.HasRequired(x => x.Record)
.WithRequiredPrincipal()
.WillCascadeOnDelete(false);
db.Switchers.AddOrUpdate(switcher);
db.SaveChanges();
db.Entry(switcher).State = EntityState.Modified;
db.SaveChanges();
private void executeOpenChildBankWin(object parameter)
{
IsNew = true;
ChildBankWin = new AddOrEditBank(this);
ChildBankWin.ShowDialog();
}
private void OkSaveChildWindowImplementation(object parameter)
{
if(IsNew)
{
Banks.Add(CurrentBank);
DbContext.Banks.Add(CurrentBank);
}
DbContext.SaveChanges();
ChildBankWin.Close();
}
_dataContext.Banks.Add(new Bank());
_dataContext.Banks.Remove(bank));
Database.SetInitializer(new CreateDatabaseIfNotExists<DbEntity>());
using (DbEntitycontext = new DbEntity())
{
var query = context.Players.ToList();
}
using (DbEntitycontext = new DbEntity())
{
context.Database.Create();
}
repositories {
maven {
url "https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/"
}
}
public class Theme
{
public int ThemeId { get; set; }
public DateTime? ThemeDate { get; set; }
public string ThemeName { get; set; }
public string ThemeDes { get; set; }
public virtual User User { get; set; }
//public int UserId { get; set; }
public virtual ICollection<ForumMessage> FMessage { get; set; }
}
{Binding Seminares, Mode=TwoWay}