我最近尝试升级一个.net 2.0项目,该项目将SubSonic 2.2生成的DAL转换为Visual Studio 2010下的.NET 4.0.
这些项目在没有错误的情况下进行了转换,但是当我尝试启动时,我现在收到一条相当卑鄙的错误消息
System.Security.VerificationException: Operation could destabilize the runtime.
at SubSonic.DataProvider.ApplyConfig(NameValueCollection config, Boolean& parameterValue, String configName) in C:\Documents and Settings\Desktop\4.0 Production\rel_1.0\server\Server.DAL\Server.DAL.SubSonic\DataProviders\DataProvider.cs:line 955
at SubSonic.DataProvider.Initialize(String name, NameValueCollection config) in C:\Documents and Settings\Desktop\4.0 Production\rel_1.0\server\Server.DAL\Server.DAL.SubSonic\DataProviders\DataProvider.cs:line 916
at System.Web.Configuration.ProvidersHelper.InstantiateProvider(ProviderSettings providerSettings, Type providerType)
Run Code Online (Sandbox Code Playgroud)
抛出异常的代码:
ApplyConfig(config, ref extractClassNameFromSPName, ConfigurationPropertyName.EXTRACT_CLASS_NAME_FROM_SP_NAME);
private static void ApplyConfig(System.Collections.Specialized.NameValueCollection config, ref bool parameterValue, string configName)
{
if(config[configName] != null)
{
parameterValue = Convert.ToBoolean(config[configName]);
}
}
Run Code Online (Sandbox Code Playgroud)
它执行类似的调用,唯一的区别是它严格地是一个字符串而不是它正在操纵的布尔值.
private static void ApplyConfig(System.Collections.Specialized.NameValueCollection config, ref string parameterValue, string configName)
{
if(config[configName] …
Run Code Online (Sandbox Code Playgroud) Rob对Massive ORM的另一篇精彩文章.我无法找到的是有关如何访问存储过程的参考. SubSonic在使用ActiveRecords时遇到了一些问题,所以我更喜欢使用存储过程进行数据访问,仍然使用SubSonic ORM.
我还没有看到的是对ORM中的SQL Server TVP的直接支持,所以我 修改了SubSonic(无耻插件)来支持它们.
是否可以使用Massive访问SQL Server sprocs.其次,是否有TVP支持?
stored-procedures sql-server-2008 table-valued-parameters subsonic2.2 massive
我的网站在我的网站上使用Subsonic 2.2.
我有一个奇怪的情况,我需要运行一些特殊的SQL语句.
public IList<string> GetDistincList(string TableName, string FieldName)
{
string sqlToRun = string.Format("SELECT DISTINCT {0} FROM {1} ORDER BY {0}", FieldName, TableName);
Query query = new Query(TableName);
query.PleaseRunThis(sqlToRun);
query.ExecuteReader();
}
Run Code Online (Sandbox Code Playgroud)
有人能帮我一下吗?看来,我只想返回一个通用的字符串列表.
谢谢!