开发者

SubSonic 3 issue creating List<>

开发者 https://www.devze.com 2022-12-23 03:14 出处:网络
I have an application that requires we use distinct user connection strings per user.We are trying to upgrade from SubSonic 2.x to 3.0.I\'m running into issues with trying to create a 开发者_如何学JAV

I have an application that requires we use distinct user connection strings per user. We are trying to upgrade from SubSonic 2.x to 3.0. I'm running into issues with trying to create a 开发者_如何学JAVAList<> of objects. When I try to create a List like this:

List<table_name> oList = table_name.All().Where(tn => tn.table_id == TableId).ToList();

I get the error "Connection string 'ConnectionStringName' does not exist."

So, I try to create the List<> like this:

List<table_name> oList = table_name.All(sConnectionString, "System.Data.SqlClient").Where(tn => tn.table_id == TableId).ToList();

I get the error "The name 'table_name' does not exist in the current context."

I'm using SQL Server, and the sConnectionString is definitely verified to be a good connection string, and the table_name is a table in the database. What am I doing wrong?


SubSonic 2.2 and 3.0 handle connection strings quite differently.

In 2.2, there is a custom configuration section where the connection name is defined.

In 3, the connection string name that is used to run the T4 templates is inserted into one of the templates and must match a connection string name in your .config file.

If you post your .config file (the relevant parts) I will edit this answer and try to provide more specific advice. Also, which v3 templates are you using?

0

精彩评论

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