我希望尽可能灵活地使我的应用程序灵活,但不要让我的界面过于具体,从而陷入困境.
存储库的最佳对象类型是什么?IEnumerable,IQueryable还是List?
我正在考虑使用的技术是
Azure App Fabric缓存
实体框架4.1
可能是Windows Server AppFabric
repository appfabric appfabric-beta-2 azure-appfabric entity-framework-4.1
假设我的DAL(ORM等)中有这个对象
public class Student
{
public string Name {get;set;}
public string Address {get;set;}
public string Phone {get;set;}
public Parent Parent {get;set;}
}
public class Parent
{
public string Name {get;set;}
public string Address {get;set;}
public string Phone {get;set;}
}
Run Code Online (Sandbox Code Playgroud)
我有一个看起来像这样的ViewModel
public class StudentDetailVM
{
public string Name {get;set;}
public string Address {get;set;}
public string Phone {get;set;}
public string ParentName {get;set;}
public string ParentPhone {get;set;}
}
Run Code Online (Sandbox Code Playgroud)
在那种情况下,我需要展平对象.我可以使用Automapper,ValueInjector等工具完成此操作,或者我可以手动执行此操作.如果有许多这样的类要处理,这是一项繁琐的工作,但似乎在这三种方法之间存在性能/开发人员效率权衡.
我在寻找指导时使用Automapper VS Valueinjector VS手动映射.我确定手动映射是最快的,但是多少?
某些场景是否比其他场景慢得多/更快(例如展平等)?
使用混合方法在层之间映射对象是否有意义?
我问的原因是因为创建了一个名为emitmapper的Codeplex项目来解决automapper中的性能问题,我记得看到一条评论说自动化器可能需要花费0.5毫秒来映射一个大类.(需要参考)
我还记得看过一篇文章,该文章介绍了如果用户在70毫秒内加载,而不是90毫秒或更长时间,他们在网站上停留的可能性会更高.(我也在寻找这个链接).如果automapper消耗了我的大部分页面加载时间,加上网络延迟,那么我发现有可能不使用automapper并为我的高容量页面创建手动类,并坚持使用混合方法.
一句话:我会自己运行测试,但是我不太了解.NET内部结构来创建可以用作可重用指南的准确结果.
似乎有两个名称相似的产品,但不是我所期望的.我认为Azure AppFabric是Windows Server AppFabric的"云"版本,但它们之间似乎没有太多共同之处.
我错过了更大的图片吗?
我正在重写我的问题,希望我能得到更好的回应.我在这里询问了关于serverfault的类似问题,并认为正确有效的TLS服务器是需要"STARTTLS"命令的服务器.
是否可以在不需要额外端口的情况下将STARTTLS发布到正确配置的LDAP或HTTP TLS服务器?我知道从SMTP的角度来看这是事实,但不确定我可以将这些经验应用到其他协议的范围.
我花时间阅读(但没有完全掌握)
问: 在建立TLS over LDAP或HTTP会话之前,线路上发生了什么?由于这是基于我可以简单地远程登录到该端口,并发出一些指令TCP来验证它的工作(最高点)?
码
using System;
internal static class Test
{
private static void Main()
{
try
{
Console.WriteLine("{0,10}: Start point", GC.GetTotalMemory(true));
Action simpleDelegate = SimpleDelegate;
Console.WriteLine("{0,10}: Simple delegate created", GC.GetTotalMemory(true));
Action simpleCombinedDelegate = simpleDelegate + simpleDelegate + simpleDelegate;
Console.WriteLine("{0,10}: Simple combined delegate created", GC.GetTotalMemory(true));
byte[] bigManagedResource = new byte[100000000];
Console.WriteLine("{0,10}: Big managed resource created", GC.GetTotalMemory(true));
Action bigManagedResourceDelegate = bigManagedResource.BigManagedResourceDelegate;
Console.WriteLine("{0,10}: Big managed resource delegate created", GC.GetTotalMemory(true));
Action bigCombinedDelegate = simpleCombinedDelegate + bigManagedResourceDelegate;
Console.WriteLine("{0,10}: Big combined delegate created", GC.GetTotalMemory(true));
GC.KeepAlive(bigManagedResource);
bigManagedResource = null; …Run Code Online (Sandbox Code Playgroud) 我将这一行从C++移植到C#,我不是一个经验丰富的C++程序员:
unsigned int nSize = BN_num_bytes(this);
Run Code Online (Sandbox Code Playgroud)
在.NET中,我使用的是System.Numerics.BigInteger
BigInteger num = originalBigNumber;
byte[] numAsBytes = num.ToByteArray();
uint compactBitsRepresentation = 0;
uint size2 = (uint)numAsBytes.Length;
Run Code Online (Sandbox Code Playgroud)
我认为它们在内部运作方式存在根本区别,因为如果BigInt等于:来源的单元测试结果不匹配:
我完全不知道BN_num_bytes(编辑:评论只是告诉我它是BN_num_bits的一个宏).
题
你会验证这些关于代码的猜测:
我需要移植BN_num_bytes哪个宏((BN_num_bits(bn)+7)/8)(谢谢@WhozCraig)
我需要移植BN_num_bits哪个floor(log2(w))+1
然后,如果存在不计算前导和尾随字节的可能性,那么Big/Little端机器上会发生什么?有关系吗?
基于Security.StackExchange上的这些答案,以及我的应用程序对性能不重要,我可能会使用.NET中的默认实现,而不是使用可能已经实现类似解决方法的备用库.
编辑:到目前为止,我的实现看起来像这样,但我不确定评论中提到的"LookupTable"是什么.
private static int BN_num_bytes(byte[] numAsBytes)
{
int bits = BN_num_bits(numAsBytes);
return (bits + 7) / 8;
}
private static int BN_num_bits(byte[] numAsBytes)
{
var log2 …Run Code Online (Sandbox Code Playgroud) 我需要用户使用开箱即用的身份验证登录到网站.我现在需要链接到Google(和其他服务)中的用户驱动器.我想使用ASP.Net身份的OAuth身份提供商来处理令牌交换,但我不希望它触及现有UserCredential或使用它SignIn的UserPrincipal
我的目标是预防
AuthenticateCoreAsync从返回AuthenticationTicket导致修改到当前登录的用户身份题
设置自定义grantIdentity有什么影响IOwinContext.Authentication.SignIn()?
SignInAsAuthenticationType能解决我的需求吗?
如果没有,何时使用?
使用Google提供商的理论代码
// The cookie needs to be First in the chain.
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = "CustomExternal",
AuthenticationMode = AuthenticationMode.Passive,
CookieName = "MyAwesomeCookie",
ExpireTimeSpan = TimeSpan.FromMinutes(5),
//Additional custom cookie options....
});
//Note that SignInAsAuthenticationType == AuthenticationType
app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions
{
AuthenticationType = "GoogleBackOffice",
ClientId = "abcdef...",
ClientSecret = "zyxwv....",
SignInAsAuthenticationType = "CustomExternal"
});
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用最新的Exchange Web服务DLL,但是当我搜索我的硬盘时,我看到许多版本的Microsoft.Exchange.WebServices.DLL,最新版本为14.0.650.7,日期为1/24/12 .
我想重建我的机器但找不到官方的地方来获取这个DLL.我试图下载最新的SDK我没有看到任何DLL使用,也没有任何CHM供我使用.
我在哪里可以获得最新版本的Microsoft.Exchange.WebServices.DLL?
我正在研究SimplSockets库来构建使用套接字的应用程序.但是,在查看Stack Overflow上的其他问题,作者的博客,源代码和几个Internet搜索之后,我找不到使用SimplSockets创建"hello world"项目的直接方法.
如何创建使用SimplSockets的"hello world"应用程序?
为了防止"过于宽泛"的关闭,我想要做的就是发送和接收一些数据.一串,无论如何.我打开这个问题的原因是因为我对如何,因为它使用调用构造函数不能确定func<T>哪里T是一个插座.
c# ×5
.net ×4
appfabric ×2
automapper ×1
azure ×1
biginteger ×1
c++ ×1
certificate ×1
cloud ×1
delegates ×1
emitmapper ×1
file-io ×1
https ×1
ldap ×1
locking ×1
memory-leaks ×1
move ×1
networking ×1
oauth ×1
openssl ×1
owin ×1
repository ×1
sockets ×1
ssl ×1
tcp ×1
wcf ×1