Closed ElvenP closed 3 years ago
Duplicate of #
是什么问题,#289有没有看这个
首先感觉作者的回复,并且是这么快的回复。 大概的流程就是这样。最后一张图就是报错的。没有注入成功。 然后我的项目中还使用了autofac。我想是不是由于与asp.net core 本身的注入有冲突。 于是我写在了autofac里面。。如下图
builder.RegisterType\
前面的错误,提示没有注入 UnitOfWorkManager,但是前面的代码看着是注入了?
builder.RegisterType
这样是对的吗,单例,还需要指定实例 fsql。 前面的错误,提示没有注入 UnitOfWorkManager,但是前面的代码看着是注入了? 注入了,在第六张图里注入了。另外
builder.RegisterType<IFreeSql我只是写了个例子,并没在autofac中使用
看前面的注入使用的是MS自带的DI的注入,没有看到 autofac 代码。
是不是从 IServiceCollection 转 autofac 的时候丢失了,在 .net core3.x 还能这样用吗
对,前面是ms自带的注入。auto注入的repos和serv.
2881099 notifications@github.com于2020年6月18日 周四18:38写道:
看前面的注入使用的是MS自带的DI的注入,没有看到 autofac 代码。
是不是从 IServiceCollection 转 autofac 的时候丢失了,在 .net core3.x 还能这样用吗
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dotnetcore/FreeSql/issues/350#issuecomment-645934721, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP5DYYJJIVR4WNTSEX4EWWDRXHVATANCNFSM4OBLHQIQ .
能否整理一个简单demo上传一下?
https://github.com/ElvenP/DotNetCoreLearn
2881099 notifications@github.com于2020年6月18日 周四18:45写道:
能否整理一个简单demo上传一下?
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dotnetcore/FreeSql/issues/350#issuecomment-645937920, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP5DYYJTIRK6KLVWWHDPGN3RXHV2ZANCNFSM4OBLHQIQ .
问题一:版本不一致,应该都用一样的版本(Admin.Core.Common.csproj)
<PackageReference Include="FreeSql" Version="1.6.0-preview0611" />
<PackageReference Include="FreeSql.Provider.SqlServer" Version="1.5.0" />
<PackageReference Include="FreeSql.Repository" Version="1.6.0-preview0611" />
运行OK,没有出现说的注入错误
在 UserService.GetAsync 方法上增加 [Transaction] 特性后,事务也生效了。
首先非常感谢您的回复,按照你的提示,我修改了这些东西后。发现f5下没有问题。。。但是ctrl+f5还是报原来的错。
2881099 notifications@github.com 于2020年6月18日周四 下午7:04写道:
[image: image] https://user-images.githubusercontent.com/16286519/85012968-6ec77e80-b196-11ea-9c4b-31a4a144caa3.png
在 UserService.GetAsync 方法上增加 [Transaction] 特性后,事务也生效了。
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dotnetcore/FreeSql/issues/350#issuecomment-645946186, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP5DYYOBCMHPKPICG6I3PPLRXHYENANCNFSM4OBLHQIQ .
直接用控制台运行呢,dotnet run
原因找到了,还是由于同时使用了di注入和autofac 注入导致的。现在改为autofac注入就正常了。如下图。非常感谢回复,已打赏。 [image: image.png]
2881099 notifications@github.com 于2020年6月18日周四 下午7:44写道:
直接用控制台运行呢,dotnet run
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dotnetcore/FreeSql/issues/350#issuecomment-645963187, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP5DYYJBV6SNXGNYEBLEYCDRXH4YDANCNFSM4OBLHQIQ .
谢谢
是什么问题,https://github.com/dotnetcore/FreeSql/issues/289 有没有看这个