开发者

Using MS Moles with datacontext and stored procedures without using a Connection string

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 fac开发者_JAVA百科t 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜