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
Arjun Mourya
NA
5
3.4k
Entity Framework in .net
Jul 25 2014 5:54 AM
Hi all,
I am developing a website which displays various reports. So I want this report to be working across different databases. Hence I decided go with Entity Framework with LINQ/Entity SQL. I also created .edmx for MSSQL and was successfully able to display values in the UI from Model which is available in App_Code folder. I want the same LINQ and Entity SQL queries to work for MySQL Database.
I created another .edmx model for MySQL DB and also was successfully able to display values in the UI.
Below is my code for MS SQL:
demoModel.demoEntities project = new demoModel.demoEntities();
//MSSQL query
string esqlQuery = @"SELECT tbl.<select_list> FROM <table_name> AS tbl";
foreach (System.Data.Common.DbDataRecord a in new System.Data.Objects.ObjectQuery<System.Data.Common.DbDataRecord>(esqlQuery, project))
{
//some code here
}
I should not be changing any Entity Model object( namely demoModel.demoEntities) name to MySQL entity model object name in the code .How to achieve this is my question?
Also I tried changing connection string in the web.config but it was throwing error as "not possible to convert from Mysql object to MSSQL object".
Please someone point me out to right tutorial link.
--
Arjun
Reply
Answers (
1
)
how to search all fields in table using mvc
How to Play in Video any format in ASP.NET MVC3