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
kiran madiraju
NA
1
781
Entity Frame work 6.0 capturing raw sql
Jun 2 2015 10:06 PM
can you please help to capture raw sql after parameter binding so that i can save and run same sql's in test and prod environment
please let me know if there is alternative ways to
accomplish
this
Thanks
//enable logging
public PcatAdminContext()
: base("name=PcatAdminContext")
{
Database.Log = WriteFile.WriteSQL;
}
//write SQL method
public static void WriteSQL(string data)
{
string path = @"c:\SQLtrace.txt";
File.AppendAllText(path, data);
}
//linq query
DESTINATION des = db.DESTINATION.Single(u => u.DESTINATION1 == destination.Destination1);
des.CLASS_RANGE = destination.ClassRange;
db.SaveChanges();
//update statement output looks like this
Started transaction at 6/2/2015 6:03:10 PM -06:00
update "PCAT_ADMIN_TOOL"."DESTINATION"
set "CLASS_RANGE" = :p0
where ("DESTINATION" = :p1)
-- :p0: 'Class Range A' (Type = String, Size = 20)
-- :p1: 'test' (Type = String, Size = 200)
-- Executing at 6/2/2015 6:03:10 PM -06:00
-- Completed in 86 ms with result: 1
//expected output
update "PCAT_ADMIN_TOOL"."DESTINATION"
set "CLASS_RANGE" = 'Class Range A'
where ("DESTINATION" = 'test')
Reply
Answers (
0
)
converting falied on boolean value
how to calculate monthly total present and current month Tot