我正在为即将到来的项目评估两个对象数据库db4o(http://www.db4o.com)和Eloquera数据库(http://eloquera.com).我必须选择一个.我的基本要求是RAD的可扩展性,多用户支持和简单的类型演变.
请分享您的真实世界体验.
如果你有两者,你能比较这两个吗?你喜欢哪个?
我在LinqPad中使用NorthWind.sdf成功运行了以下语句:
from s in Shippers
select new
{
s.ShipperID,
s.CompanyName,
Count=s.ShipViaOrders.Count()
}
Run Code Online (Sandbox Code Playgroud)
与此同时,我没有在LinqPad中与Odata Service(http://services.odata.org/northwind/northwind.svc)进行类似的声明:
from s in Shippers
select new
{
s.ShipperID,
s.CompanyName,
Count=s.Orders.Count()
}
Run Code Online (Sandbox Code Playgroud)
错误是"构造或初始化类型<> f__AnonymousType0`3 [System.Int32,System.String,System.Int32]的实例,不支持表达式s.Orders.Count()."
我知道在Linq支持中OData服务非常有限.我在我的应用程序中有动态的Linq语句支持.实际上我正在尝试将数据源从Compact SQL Server迁移到OData服务.
所以我必须以一般方式处理NotSupportedException.目前,我尝试在运行之前检查属性define的语法,例如
"s.Orders.Count() as Count"
Run Code Online (Sandbox Code Playgroud)
它通过了我的检查,但它遇到了OData的NotSupportedException.
有没有办法检查Linq提供程序是否支持属性定义(通过字符串或lambda)?
任何建议表示赞赏.
英
在System.Linq.Dynamic中,有一些方法可以动态地形成Select,Where和其他Linq语句.但SelectMany没有.
Select的方法如下:
public static IQueryable Select(this IQueryable source, string selector, params object[] values)
{
if (source == null) throw new ArgumentNullException("source");
if (selector == null) throw new ArgumentNullException("selector");
LambdaExpression lambda = DynamicExpression.ParseLambda(source.ElementType, null, selector, values);
IQueryable result = source.Provider.CreateQuery(
Expression.Call(
typeof(Queryable), "Select",
new Type[] { source.ElementType, lambda.Body.Type },
source.Expression, Expression.Quote(lambda)));
return result;
}
Run Code Online (Sandbox Code Playgroud)
我试着修改上面的代码,经过几个小时的工作,我找不到出路.
欢迎任何建议.
英
我的C#代码有很多声明,如"this.Name = ...".为了使我的代码整洁,我让文本编辑器替换所有"这个".一无所获.代码仍然有效.但后来我资助它给我带来了很多新的麻烦,因为我写了一些陈述,如:
this.Name = Name; // the second Name is a parameter.
Run Code Online (Sandbox Code Playgroud)
更换后,它变为:
Name = Name;
Run Code Online (Sandbox Code Playgroud)
现在,我遇到了太多的代码.如何找到像"Name = Name;"这样的可疑代码 Regex在VS 2010中的表现?
谢谢,
英