我使用Lamar建立了一个dotnet核心网站,我在Startup.cs中使用以下方法
r=[ grp.set_index("time") \
.assign(pid=idx) \
.rename(columns={"pid":pid}) \
for idx,(pid,grp) in enumerate(df.groupby("pid"),1) ]
e.g.: r[0]
123456
time
2019-12-13 14:00:00 1
2019-12-13 14:00:20 1
2019-12-13 14:00:40 1
2019-12-13 14:01:00 1
#rslt=pd.concat(r,axis=1).fillna(0).astype(int)
rslt=pd.concat(r,axis=1)
123456 345678 678123
time
2019-12-13 14:00:00 1 2 0
2019-12-13 14:00:20 1 2 0
2019-12-13 14:00:40 1 2 3
2019-12-13 14:01:00 1 0 3
# from matplotlib import pylab as plt
rslt.plot()
plt.show()
我要按照https://jasperfx.github.io/lamar/documentation/ioc/registration/registry-dsl/
中的文档所述使用AddInstances()使用For()。AddInstances()添加许多注册
public void ConfigureContainer(ServiceRegistry services)
{
...
}
但是,AddInstances()不存在,出现以下错误
'ServiceRegistry.InstanceExpression'不包含 “ AddInstances”的定义,没有可访问的扩展方法 'AddInstances'接受类型的第一个参数 可以找到“ ServiceRegistry.InstanceExpression”(您是 缺少using指令或程序集引用?)
// registry is a StructureMap Registry object
registry.For<IService>().AddInstances(x =>
{
// Equivalent to For<IService>().Add<ColorService>().....
x.Type<ColorService>().Named("Red").Ctor<string>("color").Is("Red");
// Equivalent to For<IService>().Add(new ColorService("Yellow"))......
x.Object(new ColorService("Yellow")).Named("Yellow");
// Equivalent to For<IService>().Use(() => new ColorService("Purple"))....
x.ConstructedBy(() => new ColorService("Purple")).Named("Purple");
x.Type<ColorService>().Named("Decorated").Ctor<string>("color").Is("Orange");
});
这是另一个名称空间吗?按照示例,它仅存在于StructureMap Registry对象上吗?如果是的话,如何从注入的ServiceRegistry中获取它?
我们将不胜感激:)