我想autocomplete使用jquery ui datepicker 禁用所有输入,而不是手动对每个输入执行此操作.怎么可能这样呢?
我有两个IQueryables:
成分:
IngId
Description
Run Code Online (Sandbox Code Playgroud)
AvailableIngredient:
IngId
Run Code Online (Sandbox Code Playgroud)
我已经有了一个IQueryable成分:
var ingQuery = from i in context.Ingredients
select i;
Run Code Online (Sandbox Code Playgroud)
如何向他添加AvailableIngredient联接以便过滤(即内部联接)?如果我必须一直加入,我知道如何做到这一点,即从...加入context.Available ...等),但是Join是有条件的,所以我需要使用其他语法:
if (filterByAvailable)
{
IQueryable<Available> availableQuery = GetAvailableIngredientQuery(context);
ingQuery = ingQuery.Join(...); // Can I use this to join to the query?
}
Run Code Online (Sandbox Code Playgroud)
这可能不是正确的方法,所以这就是我想要做的:
编辑:
这是我目前使用的代码(非常快),但它意味着重复的代码:
IQueryable<Ingredient> query;
if (filterByAvailable)
{
IQueryable<Available> availableQuery = GetAvailableIngredientQuery(context);
query = from item in context.Ingredients
// Quite a few `where` clauses and stuff
join t in availableQuery on item.IngId equals t.IngId
select item;
} …Run Code Online (Sandbox Code Playgroud) Session.Abandon()和Session.Clear()ASP.Net有什么区别?
我有一个列表视图,我正在填充8列用户数据.用户可以选择启用自动刷新,这会导致ListView被清除并使用数据库中的最新数据重新填充.
问题是当项目被清除并重新填充时,可见区域会跳回到列表的顶部.因此,如果我正在查看2000年的第1000项,那么回到那个项目是非常不方便的.
基本上,我要问的是,如何获得当前的滚动距离(x和y),然后恢复它们?
我已将我的移动设备上的数据库迁移远离VistaDB,因为它太慢了.我现在使用ProtoBuf在存储卡上创建一系列平面文件,唯一的问题是显然没有加密.
哪种加密方法最适合ProtoBuf?我基本上将一组数据实体序列化到一个文件中,然后从File反序列化回到我的集合中.我认为加密的最佳位置是在读/写的FileStream中.
数据将包含NI编号,名称和地址,因此必须是安全的.任何想法的人?
encryption serialization compact-framework protocol-buffers .net-2.0
我有以下Entity Framework POCO类:
public class Customer
{
public int Id {get;set;}
public string Name {get;set;}
public virtual ICollection<Order> Orders {get;set;}
}
public class Order
{
public int Id {get;set;}
public int CustomerId {get;set;}
public int OrderTypeId {get;set;}
public virtual OrderType Type {get;set;}
public virtual Customer Customer {get;set;}
}
public class OrderType
{
public int Id {get;set;}
public virtual ICollection<Order> Orders {get;set;}
}
Run Code Online (Sandbox Code Playgroud)
问题是,当我返回我的时候,我ICollection<Order>的Orders正常,但是它的OrderType属性Order没有被填充.我的订单将包含以下详细信息:
Id: 1
CustomerId: 1
Customer: Populated
OrderTypeId: 3
Type: …Run Code Online (Sandbox Code Playgroud) 由于整个团队已升级到Visual Studio 2015,因此调试器不再中断JavaScript中未处理的异常.然而,4台机器中的1台工作正常,我们猜测这是因为它在IE10上,而我们其余的都在IE11上.
无论如何,要涵盖明显的东西:
所有设备之间的所有设置都相同,包括Visual Studio 2015安装目录中JavaScript> JustMyCode文件夹中的mycode.default.wwa.json
新"异常设置"窗口中的默认设置与2012年旧模式窗口中的"异常"设置相匹配
因此,为了重现这个问题,我们只需在外部JS文件中编写任何旧的狡猾代码(请注意,页面本身的脚本块被正确捕获):
ViewModel.js:
function something() {
foo();
}
something();
Run Code Online (Sandbox Code Playgroud)
启用JustMyCode时,调试器不会将foo()作为未处理的异常捕获.一旦JustMyCode被禁用,异常将被捕获.所以是的,我们可以解决这个问题,但是一旦禁用,我们就会失去实际的.Net调试.
有没有人遇到过这个问题和/或找到了解决方案?我已经尝试将*.js添加到mycode.default.wwa.json文件中的MyCode部分,我还记录了Connect上的一个错误,但我不希望微软就此事快速回答.
编辑:所以这似乎只发生在JS文件末尾有一个查询字符串,例如site.js?V = 1234.如果删除查询字符串,则调试器将捕获异常,就像在Visual Studio 2012中一样.向Microsoft提交了一个新的repro和演示项目.
javascript debugging visual-studio-debugging visual-studio-2015
有没有人有任何关于如何将序列化数据加密到文件然后使用DES读回来的例子?
我已经编写了一些不起作用的代码,但我宁愿看到新的尝试,而不是追求我的代码.
编辑:对不起,忘了提我需要一个使用XmlSerializer.Serialize/Deserialize的例子.
我编写了一个程序来使用XMLSerializer,BinaryFormatter和ProtoBuf序列化一个'Person'类.我认为protobuf-net应该比其他两个更快.Protobuf序列化比XMLSerialization更快,但比二进制序列化慢得多.我的理解不正确吗?请让我明白这一点.感谢您的帮助.
编辑: - 我更改了代码(下面更新)来测量仅序列化的时间,而不是创建流,仍然看到差异.能告诉我为什么吗?
以下是输出: -
人在347毫秒内使用协议缓冲区创建
人在1462毫秒内使用XML创建
人在2毫秒内使用二进制创建
代码如下
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ProtoBuf;
using System.IO;
using System.Diagnostics;
using System.Runtime.Serialization.Formatters.Binary;
namespace ProtocolBuffers
{
class Program
{
static void Main(string[] args)
{
string folderPath = @"E:\Ashish\Research\VS Solutions\ProtocolBuffers\ProtocolBuffer1\bin\Debug";
string XMLSerializedFileName = Path.Combine(folderPath,"PersonXMLSerialized.xml");
string ProtocolBufferFileName = Path.Combine(folderPath,"PersonProtocalBuffer.bin");
string BinarySerializedFileName = Path.Combine(folderPath,"PersonBinary.bin");
if (File.Exists(XMLSerializedFileName))
{
File.Delete(XMLSerializedFileName);
Console.WriteLine(XMLSerializedFileName + " deleted");
}
if (File.Exists(ProtocolBufferFileName))
{
File.Delete(ProtocolBufferFileName);
Console.WriteLine(ProtocolBufferFileName + " deleted");
}
if (File.Exists(BinarySerializedFileName))
{
File.Delete(BinarySerializedFileName);
Console.WriteLine(BinarySerializedFileName + " …Run Code Online (Sandbox Code Playgroud) 我有一个使用大量JavaScript(主要是jQuery)的网站,我需要一个很好的全局方式让用户知道当他们离开特定页面时他们将丢失未保存的更改.
目前,我在输入上放置了一个onchange事件,并将我的主导航包装在一个函数中,该函数将在单击时显示警告.
这感觉非常笨重,并且不能很好地扩展(导航不是主要导航的一部分需要手动包装,这远非理想)
javascript ×3
.net-2.0 ×2
c# ×2
c#-4.0 ×2
encryption ×2
jquery ×2
asp.net ×1
code-first ×1
debugging ×1
des ×1
join ×1
linq ×1
listview ×1
listviewitem ×1
protobuf-net ×1
session ×1
winforms ×1