我已经开始了一个新项目,他们有一个非常规范化的数据库.可以查找的所有内容都作为外键存储到查找表中.这是规范化和精细的,但我最终为最简单的查询做了5个表连接.
from va in VehicleActions
join vat in VehicleActionTypes on va.VehicleActionTypeId equals vat.VehicleActionTypeId
join ai in ActivityInvolvements on va.VehicleActionId equals ai.VehicleActionId
join a in Agencies on va.AgencyId equals a.AgencyId
join vd in VehicleDescriptions on ai.VehicleDescriptionId equals vd.VehicleDescriptionId
join s in States on vd.LicensePlateStateId equals s.StateId
where va.CreatedDate > DateTime.Now.AddHours(-DateTime.Now.Hour)
select new {va.VehicleActionId,a.AgencyCode,vat.Description,vat.Code,
vd.LicensePlateNumber,LPNState = s.Code,va.LatestDateTime,va.CreatedDate}
Run Code Online (Sandbox Code Playgroud)
我想建议我们取消一些东西.喜欢州代码.在我的一生中,我没有看到州代码的变化.类似的故事与3个字母的代理商代码.这些由代理机构发放,永远不会改变.
当我找到状态代码问题和5表连接的DBA时.我得到了"我们正常化"和"加入很快"的回应.
反规范化有一个令人信服的论据吗?如果没别的话,我会为了理智而这样做.
T-SQL中的相同查询:
SELECT VehicleAction.VehicleActionID
, Agency.AgencyCode AS ActionAgency
, VehicleActionType.Description
, VehicleDescription.LicensePlateNumber
, State.Code AS LPNState
, VehicleAction.LatestDateTime AS ActionLatestDateTime
, VehicleAction.CreatedDate
FROM …Run Code Online (Sandbox Code Playgroud) 我们的主要客户解决方案有111个项目 当我第一次开始这个团队时,我很惊讶(并且惊慌失措)我们有这么多项目,并建议将这些层级合并到更少但更大的组件中.我们的结构具有带有nhibernate映射文件的模型(DTO),带有数据控制器调用的WCF服务层,一些框架类型项目以及具有多个模块的winform CAB应用程序.我们将使用点击一次部署.
由于构建时间(最差情况最多15分钟),其他一些团队成员现在也担心.我没有经验证据表明较少的项目是一个好主意,并且想知道堆栈溢出社区是否有任何反馈.是否有令人信服的理由改变我们的解决方案结构来整合项目?我们会遇到使用click-once部署100多个程序集的麻烦吗?加载和调用方法调用时,更多的程序集会导致缓慢吗?我们可能遇到的任何限制可能会破坏事情?
我有一个JQM应用程序,其中有一个简单的搜索页面,将结果显示为列表视图.我已将listview包装在scrollview中.它工作得很好,但是大约一半的时间滚动你选择的任何列表项目.我想抑制这种行为.
我想看到的行为是,如果你滚动并抬起手指,那么就停止滚动.如果您不滚动并点击(单击),那么您正在选择.
<div id="vehicleScroller" data-scroll="y" style="height:444px">
<p>
<ul id="vehicleSearchResults" data-role="listview">
<li>
<a href="#PartyDetailsPage" data-id='${Number}'
onclick='return $.vehicle.PartyItemClick();'>
${Name}
</a>
</li>
[... more li's...]
</ul>
</div>
Run Code Online (Sandbox Code Playgroud)
我已经将一些诊断日志记录添加到jquery.mobile.scrollview并观察触发的事件.我希望我可以在滚动时停止点击,但_handleDragStop总是在PartyItemClick()之前触发.
我也玩过改变delayedClickEnabled的开关,但它似乎没有影响链接点击行为.
我准备为_handleDragStop事件添加一些额外的计时代码,我可以查看是否我刚刚滚动并想问几个问题:
1)在我添加这个hacky计时代码之前,是否有更好的方法来取消该链接点击?
2)如果我想将自己的事件处理程序代码添加到_handleDragStop,我该怎么做.我已经尝试了一些bind()调用,但我必须得到错误的事件名称.这就是我尝试过的:
$('#vehicleScroller').bind('_handleDragStop',function(){
console.log('_handleDragStop-vehicleScroller');
});
Run Code Online (Sandbox Code Playgroud)
更新:我最终使用以下代码将一些遥测嫁接到scollview _handleDragMove事件:
// adding some custom code to the scrollview to track the
$.mobile.scrollview.prototype._handleDragMove = (function() {
var origDragMove = $.mobile.scrollview.prototype._handleDragMove;
return function __handleDragMove() {
$.util.SetLastMoveTime(); // this is the only new line of code
origDragMove.apply(this, arguments);
};
}());
Run Code Online (Sandbox Code Playgroud)
然后,当我处理点击事件时,我检查是否已经过了足够的时间.
this.SearchResultItemClick = function(){
if($.util.WasScrolling()) {
event.stopPropagation();
return false; …Run Code Online (Sandbox Code Playgroud) 我创建了以下内容以将一些数据公开为正则表达式匹配字符串以及StringDictionary.感觉就像我可以使用更少行的LINQ来做到这一点.
private const string STREETTYPES = @"ALY|Alley|AVE|Avenue|BLVD|Boulevard|CIR|Circle|CT|Court|CTR|Center|DR|Drive|EXPY|Expressway|FWY|Freeway|HALL|Hall|HWY|Highway|JCT|Junction|LN|Lane|LP|Loop|PIKE|Pike|PKWY|Parkway|PL|Place|RD|Road|ST|Street|TER|Terrace|TPKE|Turnpike|TRL|Trail|WAY|Way";
private static StringDictionary streetTypes = null;
public static StringDictionary StreetTypes
{
get
{
if (streetTypes != null) return streetTypes;
streetTypes = new StringDictionary();
var streetArray = STREETTYPES.Split(PIPE);
for (int i = 0; i < streetArray.Length-1; i = i+2)
{
streetTypes.Add(streetArray[i], streetArray[i + 1]);
}
return streetTypes;
}
}
Run Code Online (Sandbox Code Playgroud)