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
Naresh Seth
NA
84
1.8k
How to create Stored procedure in Entity framework?
Jul 5 2018 10:41 AM
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<CustomerContext>
{
public override void InitializeDatabase(CustomerContext context)
{
base.InitializeDatabase(context);
if (context.Database.SqlQuery<int>("SELECT COUNT(*) FROM sys.objects WHERE type = 'P' AND name = @uspname",
new SqlParameter("@uspname", "GetCustomers")).Single() == 0)
{
{
}
protected override void Seed(CustomerContext context)
{
IList<Customer> cust = new List<Customer>();
cust.Add(new Customer() { Name = "John", Zipcode = 98052 });
foreach (Customer c in cust)
context.Customers.Add(c);
base.Seed(context);
}
}
Reply
Answers (
3
)
Create model in angular 2
Single sign on using saml