Subsonic 3 LINQ投影问题,已解决还是没有? [英] Subsonic 3 LINQ Projection issue, fixed or no?
问题描述
我目前遇到这里(和其他几个地方)提到的问题: Subsonic 3 Linq投影问题
I'm currently experiencing the issue mentioned here (and several other places): Subsonic 3 Linq Projection Issue
这是使用3.0.0.4发布包进行的,当我从GitHub获取最新版本并进行构建时,也会发生这种情况.
This is occurring using the 3.0.0.4 release package, and it also occurs when I grab the latest from GitHub and build it.
我正在使用LINQ模板.
I am using the LINQ Templates.
我有此代码:
var newModel = new ViewModels.HomeIndexViewModel() {
PulseListViewModel =
new ViewModels.PulseListViewModel
{
Pulses = from p in _pulseQuery
join a in _accountQuery on p.AccountId equals a.AccountId
orderby p.CreateDate descending
select new PulseListViewModel.Pulse()
{
AccountName = a.Name
, Category = p.Category
, CreateDate = p.CreateDate
, Link = p.Link
, Message = p.Message
, Source = p.Source
, Title = p.Title
}
}
};
但是AccountName始终为空.
But AccountName is always null.
如果我将AccountName更改为Name:
If I change the AccountName to Name:
var newModel = new ViewModels.HomeIndexViewModel() {
PulseListViewModel =
new ViewModels.PulseListViewModel
{
Pulses = from p in _pulseQuery
join a in _accountQuery on p.AccountId equals a.AccountId
orderby p.CreateDate descending
select new PulseListViewModel.Pulse()
{
Name = a.Name
, Category = p.Category
, CreateDate = p.CreateDate
, Link = p.Link
, Message = p.Message
, Source = p.Source
, Title = p.Title
}
}
};
工作正常.但这在我们的项目中是不可接受的.我不能总是使名字排列整齐(除了事实,如果可以的话,这会使事情变得不太清楚).
It works fine. But that's not acceptable in our project; I can't always make the names line up (besides the fact that it would make things less clear if I could).
但是我很困惑,因为看来这个问题已经解决:
But I'm quite confused because it would seem this issue's been fixed:
解决了投影返回空值或空设置的问题"
"Fixed issue where Projections were returning null or empty settings"
- http://blog .wekeroad.com/2010/03/21/subsonic-3-0-0-4-released
所以,谁能告诉我:这个问题是否已解决,我是否必须应用在 http://github.com/funky81/SubSonic-3.0/commit/aa7a9c1b564b2667db7fbd41e09ab72f5d58dcdb 可以使此项工作吗?还是我错过了一些东西.因为查看当前的SubSonic信号源似乎已包含此修复程序.我觉得这应该很简单并且可以解决问题,但是我花了很多时间在上面.
So, can anyone tell me: Is this issue not fixed, and do I have to apply the changes found here at http://github.com/funky81/SubSonic-3.0/commit/aa7a9c1b564b2667db7fbd41e09ab72f5d58dcdb to make this work? Or am I missing something. Because looking through the current SubSonic source it appears this fix has been included. I feel like this should be simple and work, but instead I've spent an inordinate amount of time on it.
推荐答案
If you (me) modify SubSonic.Core according to the answer here: Subsonic 3.0 and linq
然后投影正常工作.
但是,我认为这是一个非常糟糕的解决方案,因为它需要分叉一个项目并导致性能下降一个数量级.
However, I consider this a very bad solution as it requires forking a project and introducing an order of magnitude performance decrease.
这篇关于Subsonic 3 LINQ投影问题,已解决还是没有?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!