I am trying to create stored procedure in Entity framework using context class. We have one method Up() in Dbmigration class, which we can use to create Stored procedure. But We can't inherit two classes.
Any suggestion would be a great help.
public class CustomerContextInitializer : DropCreateDatabaseAlways
{
public override void InitializeDatabase(CustomerContext context)
{
base.InitializeDatabase(context);
if (context.Database.SqlQuery("SELECT COUNT(*) FROM sys.objects WHERE type = 'P' AND name = @uspname",
new SqlParameter("@uspname", "GetCustomers")).Single() == 0)
{
{
}
protected override void Seed(CustomerContext context)
{
IList cust = new List();
cust.Add(new Customer() { Name = "John", Zipcode = 98052 });
foreach (Customer c in cust)
context.Customers.Add(c);
base.Seed(context);
}
}

Jignesh KumarPosted Jul 6, 2018, 3:57 AM
Naresh SethPosted Jul 6, 2018, 7:41 AM
Manav PandyaPosted Jul 5, 2018, 1:01 PM