2

If you look at the signature of the abstract class DBMigration in the System.Data.Entity.Migrations namespace:

public virtual void Down();
public abstract void Up();

You'll see that Down() is marked virtual and Up is marked abstract. The difference between virtual and abstract is that an abstract function can have functionality in it.

What kind of functionality can the Up() function have default and why isn't it the case with th Down() function.

Community
  • 1
  • 1
Timo Willemsen
  • 8,717
  • 9
  • 51
  • 82

1 Answers1

2

You need to override Up() while overriding Down() is optional. This makes sense for database migration instructions.

See also What is the difference between an abstract function and a virtual function?.

Community
  • 1
  • 1
Matthias
  • 7,432
  • 6
  • 55
  • 88