小编Chr*_*isB的帖子

类库,实体框架代码优先和Microsoft.SqlServer.Types

我有一些问题试图获得代码优先的Entity Framework 6.0来构建迁移Microsoft.SQLServer.Types.我还是继续说:

空间类型和函数不适用于此提供程序,因为无法找到程序集"Microsoft.SqlServer.Types"版本10或更高版本.

我看到他们一直在谈论跑步:

SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
Run Code Online (Sandbox Code Playgroud)

或类似的global.asax.我需要在一个处理我的应用程序的数据层的类库中运行它,因此没有启动事件.

我投入了

[assembly: PreApplicationStartMethod(typeof(Test.Startup), "Start")]
namespace Test
{
    public class Startup
    {
        public static void Start()
        { 
             SqlServerTypes.Utilities.LoadNativeAssemblies(AppDomain.CurrentDomain.BaseDirectory);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

但这没有任何效果.有人有任何其他想法吗?

谢谢

克里斯

c# sql-server entity-framework class-library code-first

2
推荐指数
1
解决办法
625
查看次数