正准备写一个基于NBear IoC的框架。现在已经做了一个Service的接口,如下
namespace ServiceInterface
{
public interface IEntityOperator<EntityType> : IServiceInterface
{
EntityType[] GetAllEntities();
}
}
接口的实现,如下
namespace ServiceImpls
{
public class EntityService<EntityType> : IEntityOperator<EntityType>
where EntityType : Entity, new()
{
public EntityType[] GetAllEntities()
{
return Gateway.Default.FindArray<EntityType>(WhereClip.All, OrderByClip.Default);
}
}
}
以后准备丰富了接口的方法,就可以很方便的访问数据库。但在配置web.config的时候出现了问题一般非泛型的接口,在web.config中这样配置,如下
<component id="category service" service="ServiceInterface.ICategoryService, ServiceInterface" type="ServiceImpls.CategoryService, ServiceImpls"/>但因为使用了泛型,我采用如下配置
<component id="product service" service="ServiceInterface.IEntityOperator<EntityType>, ServiceInterface" type="ServiceImpls.EntityService<EntityType>, ServiceImpls"/>其中<EntityType>被程序读出来后是“<EntityType>”的样子但无论按正常的方式配置还是后面的配置,程序都提示我的接口实现无法located错误码为The type name ServiceImpls.EntityService, ServiceImpls could not be located
或
The type name ServiceImpls.EntityService<EntityType>, ServiceImpls could not be located不知道怎么配置是正确的。
namespace ServiceInterface
{
public interface IEntityOperator<EntityType> : IServiceInterface
{
EntityType[] GetAllEntities();
}
}
接口的实现,如下
namespace ServiceImpls
{
public class EntityService<EntityType> : IEntityOperator<EntityType>
where EntityType : Entity, new()
{
public EntityType[] GetAllEntities()
{
return Gateway.Default.FindArray<EntityType>(WhereClip.All, OrderByClip.Default);
}
}
}
以后准备丰富了接口的方法,就可以很方便的访问数据库。但在配置web.config的时候出现了问题一般非泛型的接口,在web.config中这样配置,如下
<component id="category service" service="ServiceInterface.ICategoryService, ServiceInterface" type="ServiceImpls.CategoryService, ServiceImpls"/>但因为使用了泛型,我采用如下配置
<component id="product service" service="ServiceInterface.IEntityOperator<EntityType>, ServiceInterface" type="ServiceImpls.EntityService<EntityType>, ServiceImpls"/>其中<EntityType>被程序读出来后是“<EntityType>”的样子但无论按正常的方式配置还是后面的配置,程序都提示我的接口实现无法located错误码为The type name ServiceImpls.EntityService, ServiceImpls could not be located
或
The type name ServiceImpls.EntityService<EntityType>, ServiceImpls could not be located不知道怎么配置是正确的。
解决方案 »
- winform C# 如何上传FTP本地指定的文件呢?
- 关于PropertyGrid控件验证的问题
- 求助
- 从数据库表提取数据
- 小弟要学习RGB与CMYK转化方面的知识,求各位给点好资料!比如说我的一副照片由RGB转换为CMYK,对图片有什么影响呢?哪个转换算法比较好?如果您知道或您知道这方面的资料,请告诉小弟!谢谢!
- 我想请问一下有没有ComboBox限定不可被下拉的方法??
- C#中快捷方式的创建
- 参数传递出错的问题
- 在哪能找到bmp格式,16X16的图标啊?
- 请问table的合并行、列的问题
- 关于搜索word文档内某些内容的问题
- win32 api 中有这样一个函数 MiniDumpWriteDump 在c#中如何调用?
原来castle有具体的规范http://www.castleproject.org/container/documentation/v1rc3/usersguide/genericssupport.html<component
id='int.repos.generic'
service='Namespace.IRepository`1, AssemblyName'
type='Namespace.Repository`1, AssemblyName' />“`1”即可表达我的那个泛型