Using MS Moles with datacontext and stored procedures without using a Connection string.
Posted
by
Brian
on Stack Overflow
See other posts from Stack Overflow
or by Brian
Published on 2011-02-09T23:22:45Z
Indexed on
2011/02/09
23:25 UTC
Read the original article
Hit count: 406
I have just begun to work with MS Moles for testing and I have followed the idea/pattern in which jcollum(thanks) uses a Mole for a table in this stackoverflow question here.
But I am having a problem as I do not want to have to pass a connection string when I use the datasource as such:
using (TheDataContext dataContext = new TheDataContext(myConnectionString))
{
dataContext.ExecuteStoredprocedure(value, ref ValueExists);
}
I really like the fact that I just need to mole the table and everything else is done for me. I realize I could just mole the ExecuteStoredProcedure method, but I am wondering if I could just somehow avoid the sql exception I am getting here when I do not pass in the connection string. Or, if I there is a better way to do this?
Therefore, does anyone have a solution so that I can avoid placing in the connection string? Thanks in advance.
© Stack Overflow or respective owner