Closed sgf closed 2 years ago
Thanks for reporting. I will look.
There are multiple problems here.
First, whatvdo you wsnt to achieve?
If you want to specify the delegate (chain of calls) to create the service then use the RegisterDelegate
.
Your code without the RegisterSingleton
maybe writing as following:
container.Register(ctx => new FreeSql.FreeSqlBuilder()
.UseConnectionString(FreeSql.DataType.Sqlite, "test.db", null)
.UseAutoSyncStructure(true)
.UseMonitorCommand(cmd => Console.Write(cmd.CommandText), null)
.Build(),
Reusr.Singleton);
Second, Made.Of
expression does not support the calls chain anyway - only single method or constructor call with optional property initializer list. Its goal is to provide the way to specify required service types, service keys or primitive values for injected parameters. Consider it as advanced thing and don't try to wrap this complexity - use when needed.
Think of Made.Of
as advanced concept when you have some runtime reflection info
@sgf Btw, if you see the lack of documentation please open the issue or suggest the edit.
use RegisterDelegate is the right way, many thanks
no lack of documentation,but the documentation also complex for me. 😂 if more easy,dryioc will more pop. any way,dryioc also great job.
The parameters of Register or MadeOf are complex for me to understand the logic.
is that because .Build() returned is an instance IFreeSql ?
what should i do