Learning Notes

internal 同1程序集
sealed 不允许继承

add existing item -> add as link

数组
public char this[int index]

fixed unsafe code

unsafe 体内,可以使用 pointer type

sqlcmd

osql

delegate string Action()

Func<>

default(T)
在泛型类和泛型方法中产生的一个问题是,在预先未知以下情况时,如何将默认值分配给参数化类型 T: T 是引用类型还是值类型。如果 T 为值类型,则它是数值还是结构。
给定参数化类型 T 的一个变量 t,只有当 T 为引用类型时,语句 t = null 才有效;只有当 T 为数值类型而不是结构时,语句 t = 0 才能正常使用。解决方案是使用 default 关键字,此关键字对于引用类型会返回 null,对于数值类型会返回零。对于结构,此关键字将返回初始化为零或 null 的每个结构成员,具体取决于这些结构是值类型还是引用类型。以

扩展方法:
public static class Class1
{
public static string Add(this string s, string s2)
{
return s + s2;
}

}

索引
public typeName this[int index]

Attribute
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
public class ValidationBehaviorAttribute : Attribute, IEndpointBehavior, IContractBehavior, IOperationBehavior

config file中type的写法
<add verb=”*” path=”*.asmx” validate=”false” type=”System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″/>
type:class path(included namespace), assembly name, version , culture ,publickey

基类&抽象类

数据持久层
J2EE的三层结构是指表示层(Presentation),业务逻辑层(Business Logic)以及基础架构层(Infrastructure),这样的划分非常经典,但是在实际的项目开发法中,开发者通常对三层结构进行扩展来满足一些项目的具体要求,一个最常用的扩展就是将三层体系扩展为五层体系,即表示层(Presentation)、控制/中介层(Controller/Mediator)、领域层(Domain)、数据持久层(Data Persistence)和数据源层(Data Source)。它其实是在三层架构中增加了两个中间层。控制/中介层位于表示层和领域层之间,数据持久层位于领域层和基础架构层之间。由于对象范例和关系范例这两大领域之间存在“阻抗不匹配”,所以把数据持久层单独作为J2EE体系的一个层提出来的原因就是能够在对象-关系数据库之间提供一个成功的企业级映射解决方案,尽最大可能弥补这两种范例之间的差异。
三种持久层主流解决方案
1、JDBC
许多开发者用JDBC进行数据库程序的开发。此中方式很多情况下都使用DAO模式,采用SQL进行查询。虽然用此方式可以使应用程序代码与具体的数据库厂商和数据库位置无关,不过JDBC是低级别的数据库访问方式,JDBC并不支持面向对象的数据库表示。JDBC数据库表示完全围绕关系数据库模型。在大型应用程序的DAO中书写这样的代码,维护量是非常大的。
2、EJB
在J2EE的规范中,为EJB定义了两种持久化的解决方案:一种是BMP,另一种是CMP。其中CMP不需要将SQL语句加入到代码中。目前,在采用J2EE的应用中,EJB CMP方式得到了广泛应用。更加引人注意的是,随着EJB规范的发展,CMP也包含了一些高级关系的内容。但是,CMP的使用比较复杂,对很多开发人员来说比较难以掌握。而且,不是在所有的情况下都适合在系统中采用EJB,而且想要非常清楚的了解EJB规范也是非常费时的。在用EJB编码前,先要让专家理解API,然后需要了解每一个容器部署时所要关注的技术。此外,许多情况下商用容器的性能和支持也不是很好。
3、JDO
JDO是一个存储java对象的规范,JDO规范1.0的提出可以使你将精力集中在设计Java对象模型,然后在企业应用软件架构的不同层面中存储传统的Java对象(Plain Old Java Objects,简称POJOs),采用JDOQL语言进行SQL操作。一些公司(包括sun)企图根据JDO规范进行设计并实现JDO产品,然而他们都不能很好的进行实现,并且性能优化上比较差。
符号
位运算
& 与 两个位都为1时,结果才为1
| 或 两个位都为0时,结果才为0
^ 异或 两个位相同为0,相异为1
~ 取反 0变1,1变0
<< 左移 各二进位全部左移若干位,高位丢弃,低位补0
>> 右移 各二进位全部右移若干位,对无符号数,高位补0,有符号数,各编译器处理方法不一样,有的补符号位(算术右移),有的补0(逻辑右移)

比较运算
^  运算符是为整型和 bool 类型预定义的。对于整型,^ 将计算操作数的按位“异或”。对于 bool 操作数,^ 将计算操作数的逻辑“异或”;也就是说,当且仅当只有一个操作数为 true 时,结果才为 true
?? 如果 ?? 运算符的左操作数非 null,该运算符将返回左操作数,否则返回右操作数。

int? long?
值类型后面加问号表示可为空null(Nullable 结构)
可空类型可表示一个值,或表示不存在任何值。例如,类似 String 的引用类型就是可空类型,而类似 Int32 的值类型不是可空类型。Nullable 结构支持将值类型扩展为可以为null,但不支持在引用类型上使用,因为引用类型本身就是可空的。

Windows系统中目录名长度小于248字符(最多247个字符),包括盘符“D:\”(3个字符),目录和目录之间“\”(1个字符,目录和文件之间的“\”不算长度),加上文件名必须小于260字符(最多259个字符,目录名短,文件名就可以长,目录名长,文件名就要短,总共两者加在一起要小于260个字符)

0x代表16进制

10.0.1600其实就是SQL 2008
10.0.2531其实就是 SQL Server 2008 SP1
10.50.1600其实就是SQL 2008 R2
10.50.2500其实就是SQL 2008 R2 SP1

–清除存储过程缓存
DBCC FREEPROCCACHE

–清除会话缓存
DBCC FREESESSIONCACHE

–清除系统缓存
DBCC FREESYSTEMCACHE(‘All’)

–清除所有缓存
DBCC DROPCLEANBUFFERS

批量导入
BULK INSERT

Rapid Application Development (RAD) 快速应用开发

系统开发生命周期(System Development Life Cycle) SDLC

OOP原则:
开闭原则(Open Close Principle)
单一职责原则(Single Responsibility Principle)
Liskov Substitution Principle(LSP) 里氏代换原则
DIP(Dependence Inversion Principle)依赖倒置原则
ISP(Interface Segregation Principle)接口分离原则
LOD(Law of Demeter)迪米特原则
CARP(Composite/Aggregate Reuse Principle)优先使用组合而不是继承原则

POCO (Plain Old CLR Objects) classes(简单传统CLR对象)

non-generic 非泛型

thread pool number: the default maximum for .NET 4.5 is 5,000

.sdf文件:微软SQL Server精简版(SQLCE)数据库文件

sqlce连接字符串:<add name=”MovieDBContext”     connectionString=”Data Source=|DataDirectory|Movies.sdf”     providerName=”System.Data.SqlServerCe.4.0″/>

vs2012中自带localDB express

View流程:
_ViewStart->_Layout->

自定义Field模版
DisplayTemplates EditorTemplates
然后以数据类型为文件名,如DateTime.cshtml, Decimal.cshtml
优先使用自定义模版->DisplayFormat->DataType

int.tostring(“X”)
“X”格式说明符将整数转换为十六进制值的字符串表示形式

ValueType
提供值类型的基类。
ValueType 用更合适的值类型实现重写 Object 中的虚方法。 请参见从 ValueType 继承的 Enum。
数据类型分隔为值类型和引用类型。值类型要么是堆栈分配的,要么是在结构中以内联方式分配的。引用类型是堆分配的。引用类型和值类型都是从最终的基类 Object 派生出来的。 当值类型需要充当对象时,就在堆上分配一个包装(该包装能使值类型看上去像引用对象一样),并且将该值类型的值复制给它。该包装被加上标记,以便系统知道它包含一个值类型。这个进程称为装箱,其反向进程称为取消装箱。装箱和取消装箱能够使任何类型像对象一样进行处理。

GroupBy lamda表达示中,GroupBy返回IEnumberable<IGroup<TKey,TValue>>,即集合中套集合。想像SQL查询出来的,每个Group是1个集合,Key是这个集合的标识符,它们在一起成为外层集合的1个元素

嵌入的资源
如果并没有显示的将文件放入项目资源中(.resource),但文件自身设置了“嵌入的资源”,可以直接进行调用“Assembly.GetExecutingAssembly().GetManifestResourceStream(PuzzlerService.dict.txt)”,其中PuzzlerService是namespace,dict.txt是文件名

MVP模式
MyForm,除了要继承Form,还需要实现IView接口,IView定义表现层的动作、属性和事件,Presenter class会包含IView和IService,另外会有Service实现IService,这样在Presenter当中,IView和Iservice都是抽象的接口,不会与具体的实例有任务依赖,View(Form)和Service只依赖与接口,并且IView的事件也是由Presenter提供具体的实现,而不是在View(Form)中实现,在View中触发1个事件,只是引用Presenter相应的委托

closed/opened generic type 封闭的泛型,开放的泛型

装饰者模式(Decorator Pattern) 原类与装饰类共同实现相同的接口,装饰类将原类作为自身的构造参数或者其它形式进行注入。装饰类可以重载原类所有的方法,也可以只实现某1个方法。由于共同继承相同的接口,所以原类仍然可以引用new 装饰者()后的新类。所谓装饰,就是后期能给原类的方法添加装饰、进行扩展

IPC Inter-Process Communication 进程间通信

VBA
Visual bisic for application
Visual Basic for Applications enables building user-defined functions (UDFs), automating processes and accessing Windows API and other low-level functionality through dynamic-link libraries (DLLs). It supersedes and expands on the abilities of earlier application-specific macro programming languages such as Word’s WordBasic. It can be used to control many aspects of the host application, including manipulating user interface features, such as menus and toolbars, and working with custom user forms or dialog boxes.
As its name suggests, VBA is closely related to Visual Basic and uses the Visual Basic Runtime Library, but it can normally only run code within a host application rather than as a standalone program. It can, however, be used to control one application from another via OLE Automation. For example, it is used to automatically create a Word report from Excel data, which are automatically collected by Excel from polled observation sensors. VBA has the ability to use (but not create) (ActiveX/COM) DLLs, and later versions add support for class modules.
VBA is built into most Microsoft Office applications, including Office for Mac OS X (apart from version 2008) and other Microsoft applications such as Microsoft MapPoint and Microsoft Visio, as well as being at least partially implemented in other applications such as ArcGIS, AutoCAD, CATIA and WordPerfect.

MTS
Microsoft Transaction Server (MTS) was software that provided services to Component Object Model (COM) software components, to make it easier to create large distributed applications. The major services provided by MTS were automated transaction management, instance management (or just-in-time activation) and role-based security. MTS is considered to be the first major software to implement aspect-oriented programming.
MTS was first offered in the Windows NT 4.0 Option Pack. In Windows 2000, MTS was enhanced and better integrated with the operating system and COM, and was renamed COM+. COM+ added object pooling, loosely-coupled events and user-defined simple transactions (compensating resource managers) to the features of MTS.
COM+ is still provided with Windows Server 2003 and Windows Server 2008, and the Microsoft .NET Framework provides a wrapper for COM+ in the EnterpriseServices namespace. The Windows Communication Foundation (WCF) provides a way of calling COM+ applications with web services. However, COM+ is based on COM, and Microsoft’s strategic software architecture is now web services and .NET, not COM. There are pure .NET-based alternatives for many of the features provided by COM+, and in the long term it is likely COM+ will be phased out.

event & delegate
1.事件产生者(对象A),拥有事件和事件处理程序。比如Button对象,拥有Click事件,以及OnClick处理程序。Click事件是个委托(事件基于委托)。
2.对象A的其它方法D会引用OnClick方法,其意义在于在某种情况下,会引发这个OnClick,而在OnClick内部会调用Click事件来进行处理
3.事件订阅者(对象B),拥有一个与Click事件的返回类型和形参完全相同的方法C
4.对象B的其它方法中,会针对A的Click事件进行订阅,把C增加到A的Click事件的引发列表中(Click事件的指针指向了C)
5.这样未来一旦A引发D,D便会引发OnClick,而OnClick封装了Click事件(委托,函数指针),Click事件指向了C
ent lib exception handling
1.如果1个policy有多个handler,按照顺序1个个执行

FTP的端口是 21
SSH (Secure Shell)服务使用tcp 22 端口
TELNET  23 端口
DHCP server的端口号是67
MAIL 的端口号是25\110
pop3\smtp 的端口号是 110/25
DNS 的端口号是 53
HTTP通信用的端口号是80
mysql默认端口是3306
Sql服务的默认端口. 1433
tomcat默认端口是8080
windows远程终端 的端口号是3389
ORACLE默认端口1521、1526

devenv /resetuserdata
devenv /resetsettings
Devenv /ResetSkipPkgs

SignalR  是一组供 ASP.NET 开发人员使用的库,用于向 Web 应用程序添加实时消息、推送通知和用户交互。

SLA Service Level Agreement 服务水平协议

mvc filter:
累似于Enterprise library中的interception,提供对function的功能拦截。mvc filter中有4种基本的filters,分别是authorization filter, action filter, result fitler, exception filter.

DDL 数据定义语言(Create,drop,alter…)
DML 数据操纵语言(select,update,insert,delete…)
DCL 数据控制语言(grant,deny,revoke..)
WSDL Web Serivces Description Language

nbtstat 通过IP获得netbios名称

SET IDENTITY_INSERT [dbo].[Table_1] ON 开启某个表的ID的人工插入

Rest Post/Delete/PUT/Get/Option
When you are typing something in the address-bar and issuing a request it’s always a GET request. You can issue the OPTIONS,DELETE, PUT requests only through code using an XmlHttpRequest object. Sadly the html form currently support only GET and POST methods in the action attribute but I hope in future it may be extended to support other methods like PUT, DELETE etc.
XMLHttpRequest can support put/get/delete/post
html form only support post/get

sqlce sql compact edition .sdf

Visual Studio Extensions and Updates location
Most extensions are per-user extensions, which are installed in %LocalAppData%\Microsoft\VisualStudio\<Visual Studio version>\Extensions\. Some extensions are administrative extensions, which are installed in <Visual Studio installation folder>\Common7\IDE\Extensions\.

“无法加载指定的元数据资源”
metadata=res://*/Models.Authorize.csdl|res://*/Models.Authorize.ssdl|res://*/Models.Authorize.msl;”
metadata:指明.csdl/.ssdl/.msl三个文件的路径

SSDL 存储架构定义语言(Store Schema Definition Language)
CSDL 概念架构定义语言(conceptual schema definition language)
MSL 存储架构和概念架构之间 映射架构语言

datetime范围 1753 年1 月1 日到9999 年12 月31 日

泛型类的构造函数 与泛型类同名,但不带<T>

Template 里面可以再调用 Template, 只要是EditorFor,DisplayFor
Template 里面使用@section是无效的,第1层的view可以

MVC锚点 Redirect(Url.RouteUrl(new { controller = “Thread”, action = “ShowThreadLastPostPage”, threadOid = threadId }) + “#” + postOid)

Developer box (Debug), QA Server, Staging/Pre-Production, Production (Release)

public event EventHandler EndRequest
{
add //add方法
{
this.AddSyncEventHookup(HttpApplication.EventEndRequest, (Delegate) value, RequestNotification.EndRequest);
}
remove //remove方法
{
this.RemoveSyncEventHookup(HttpApplication.EventEndRequest, (Delegate) value, RequestNotification.EndRequest);
}
}

mail settings:
<smtp from=”youzhu@***.com.sg”>
<network host=”spartan.***.com.sg” defaultCredentials=”false” userName=”youzhu” password=”***”/>
</smtp>

tfs structure:
cr, dev, main, release.  cr = change request

power shell for service start and stop:

$s = “w3svc”
$a = get-service $s
$r = $a | findstr “unning”
if([String]::IsNullOrEmpty($r))
{
echo “currently the service was not Running”
exit 0
}
else
{
net stop $s
}

$a = get-service $s
$r = $a | findstr “unning”
if([String]::IsNullOrEmpty($r))
{
net start $s
}
else
{
echo “currently the service was Running”
exit 0
}
本地数据库:
Access, sql server compact, sqlite

open file dialog filter: “txt files (*.txt)|*.txt|All files (*.*)|*.*”

sliverlight 数字签名: signtool sign /v /f certificateFile.pfxfileToSign
svcutil方式生成client code
svcutil http://localhost:50070/svc/EasySearch.Confirmation.Business.Confirmation_BusinessService.svc /r:EasySearch.Confirmation.DomainModel.dll /r:EasySearch.Framework.DomainModel.dll /n:*,EasySearch.Confirmation.UI.Confirmation_BusinessService /async /mc /edb

wmimgmt.msc wf.msc tpm.msc taskschd.msc sqlservermanager11.msc services.msc secpol.msc rsop.msc printmanagement.msc perfmon.msc napclcf.msc lusrmgr.msc iis6.msc iis.msc gpedit.msc fsmgmt.msc eventvwr.msc diskmgmt.msc compmgmt.msc comexp.msc certmgr.msc azman.msc

指定格式化字符串,a使用16进制, b使用yyyyMMdd, c使用MMdd
string.format(“xxx{0:x8}xxx{1:yyyyMMdd}xxx{2:MMdd}”,a,b,c)

global:: 命名空间别名限定符 (::) 用于查找标识符。 它通常放置在两个标识符之间 global::System.Console.WriteLine(“Hello World”);

& 运算符既可作为一元运算符也可作为二元运算符。
一元 & 运算符返回操作数的地址(要求 unsafe 上下文)。
对于整型,& 计算操作数的逻辑按位“与”。 对于 bool 操作数,& 计算操作数的逻辑“与”;也就是说,当且仅当两个操作数均为 true 时,结果才为 true。

| 运算符 是为整型和 bool 预定义的。 对于整型, |计算操作数的按位“或”。 对于 bool 操作数, | 计算操作数的逻辑“或”;也就是说,当且仅当两个操作数均为 false 时,结果才为 false。

二元 ^ 运算符是为整型和 bool 类型预定义的。 对于整型,^ 将计算操作数的按位“异或”。 对于 bool 操作数,^ 将计算操作数的逻辑“异或”;也就是说,当且仅当只有一个操作数为 true 时,结果才为 true。

! 是对操作数求反的一元运算符。 为 bool 定义了该运算符,当且仅当操作数为 false 时才返回 true。

~ 运算符对操作数执行按位求补运算,其效果相当于反转每一位。 按位求补运算符是为 int、uint、long 和 ulong 类型预定义的。

&& 条件“与”运算符 (&&) 执行其 bool 操作数的逻辑“与”运算,但仅在必要时才计算第二个操作数。

|| 执行的逻辑或。 如果第一个操作数计算结果为 true,第二个操作数对象不会计算。 如果第一个操作数计算结果为 false,第二个运算符确定或表达式整体是否计算结果为 true 或 false。
左移运算符 (<<) 将第一个操作数向左移动第二个操作数指定的位数。 第二个操作数的类型必须是一个 int 或具有向 int 的预定义隐式数值转换的类型。

右移运算符 (>>) 将第一个操作数向右移动第二个操作数所指定的位数。

&=, |=, ^=, <<=, >>= 皆是赋值, 可以看到按位运算皆可进行赋值. 因为位运算是数字的计算.

* 运算符用来声明指针类型和取消引用指针。 该运算符只能在不安全的上下文中使用

-> 运算符将指针取消引用与成员访问组合在一起。只能在标记为不安全的代码中使用 -> 运算符。x->y等效于(*x).y
Read = 1,    Write = 2,    Append = 4,    PathDiscovery = 8,    AllAccess = PathDiscovery | Append | Write | Read
这样设置后(1,2,4,8), 在使用时如果使用Read|Write, 这样就是可以的了, 代表着既有Read, 也有Write权限, 因为|是2进制比较, Read的2进制是01, write的2进制是10, 这样|的结果就是11

LDAP格式: LDAP://192.168.80.11/CN=Ni You Zhu  (NCSI SZ),OU=People,OU=Suzhou,OU=China,DC=ncs,DC=corp,DC=int-ads

GC: has a special thread dedicated to executing Finalize methods.  the Finalize methods means ~ClssName()

.net framework: mscorlib.dll

win32 dll: kernel32.dll, user32.dll,

.NET Framework 具有两个读取器/编写器锁:ReaderWriterLockSlim 和 ReaderWriterLock。 对于所有新的开发建议使用 ReaderWriterLockSlim。 ReaderWriterLockSlim 类似于 ReaderWriterLock,但简化了递归规则以及升级和降级锁定状态的规则。 ReaderWriterLockSlim 可避免多种潜在的死锁情况。 此外,ReaderWriterLockSlim 的性能明显优于 ReaderWriterLock。

ReaderWriterLockSlim:
使用 ReaderWriterLockSlim 来保护由多个线程读取但每次只采用一个线程写入的资源。 ReaderWriterLockSlim 允许多个线程均处于读取模式,允许一个线程处于写入模式并独占锁定状态,同时还允许一个具有读取权限的线程处于可升级的读取模式,在此模式下线程无需放弃对资源的读取权限即可升级为写入模式。

ReaderWriterLock:
用于同步对资源的访问。 在任一特定时刻,它允许多个线程同时进行读访问,或者允许单个线程进行写访问。 在资源不经常发生更改的情况下,ReaderWriterLock 所提供的吞吐量比简单的一次只允许一个线程的锁(如Monitor)更高。

显示接口的作用: 如果同时继承了多个接口, 且接口当中有相同的方法和访问值, 以用区分分别实现的是哪个接口的方法.

ThreadStatic:
标记为 ThreadStaticAttribute 的静态(在 Visual Basic 中为 Shared)字段不在线程之间共享。每个执行线程都有单独的字段实例,并且独立地设置及获取该字段的值。如果在不同的线程中访问该字段,则该字段将包含不同的值。

弹性分布式数据集(RDDS)

Search your program in registry keys
[KHEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall]
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall]

Extensions Path:
AppData\Local\Microsoft\VisualStudio\12.0\Extensions

泛型:
where T: struct 类型参数必须是值类型
where T: class 类型参数必须是引用类型
where T: new() 类型参数必须有一个 public 且无参数的构造函数
where T: <base classname> 类型参数必须继承至指定的基类(base class)
where T: <interface name> 类型参数必须是指定的接口或实现了指定接口的类型
where T: U 为 T 提供的类型参数必须是为 U 提供的参数或派生自为 U 提供的参数
泛型的构造函数,不需要在PageReuslt后加T:
public PageResult (IEnumerable<T> items, string nextPageLink, int count)

await:
await 运算符在异步方法应用于任务,以挂起执行方法,直到所等待的任务完成。 这个任务表示正在进行的工作。
在其中使用 await 的异步方法必须通过 async 关键字进行修改。使用 async 修饰符定义并且通常包含一个或多个 await 表达式的这类方法称为异步方法。
await 表达式不阻止正在执行它的线程。而是使编译器将剩下的异步方法注册为等待任务的延续任务。控制权随后会返回给异步方法的调用方。任务完成时,它会调用其延续任务,异步方法的执行会在暂停的位置处恢复。
await 表达式只能在由 async 修饰符标记的立即封闭方法体、lambda 表达式或异步方法中出现。术语“await”在该上下文中仅用作关键字。在其他位置,它会解释为标识符。在方法、lambda 表达式或匿名方法中,await 表达式不能在同步函数体、查询表达式、lock 语句块或不安全上下文中出现。

AutoResetEvent:
set(): 释放信号,开始执行wait()后代码。
WaitOne(): 挂起所在线程后任代码,等待set()释放信号。

roslyn
The .NET Compiler Platform (“Roslyn”) provides open-source C# and Visual Basic compilers with rich code analysis APIs.

iisexpress
bindingInformation=”*:55369:localhost” => bindingInformation=”:55369:*” 就可以在外网访问了,否则只能在本机访问

logparser
a microsoft log parse tool. interop.msutil

tlbimp
a vs command, convert a .net library to an assembly.

<httpRuntime targetFramework=”4.5″ requestPathInvalidCharacters=”%3C,%3E,%25,%26,%3A,%5C,%3F” />
asp.net中排除路径中对*的限制,默认的限制有<,>,*,%,&,:,\\,?

nuget package version : Sematic version.  3 parts(major, minor, patch)

.woff    application/x-woff

The CLRS.Net 指运行在clr上面的语言,比如c#,vb.net,F#…

add-migration InitialSchema 会自动基于当前DB创建一个初始化的schema.

msmq path format:
create: @”.\private$\demo”   receive: net.msmq://localhost/private/demo
public name : “.\\myQueue”
private name: “.\\Private$\\myQueue”
label name: “Label:TheLabel”
format name:”FormatName:Public=5A5F7535-AE9A-41d4-935C-845C2AFF7112″
computer Journal name: “.\\Journal$”
queue’s journal name: “.\\myQueue\\Journal$”

命名约定
获取器或查询器

Getter
Finder
Accessor

验证器或比較器

Checker
Matcher
Validator
Comparator
Sorter

改动器或编辑器

Modifier
Updater
Adjuster
Editor

发送器或接收器

Emitter
Sender / Receiver
Broadcaster / Multicaster

訪问器或迭代器

Visitor
Iterator

生命周期相关

Loader
Parser
Constructor / Maker / Creator / Generator
Initializer
Register
Activator
Starter
Stopper
Destroyer

事件相关

Listener
Producer / Consumer
Observer / Observable
Timer

封装或容纳

Adapter
Wrapper
Container
Server

过滤器或拦截器

Filter
Interceptor

用户角色相关

Signer
Owner
User
Member
Operator
Authenticator

代理类

Proxy
Broker
Delegate
Gateway

监控,跟踪或探查器

Detector
Profiler
Monitor
Tracker
Introspector

多线程相关

Synchronizer
Blocker
Holder
Worker

辅助类或工具类

Helper
Supporter
Util
Utility
Kit
Tool
Toolkit

创建或生成器

Maker
Creator
Generator
Constructor
Builder
Supplier
Provider
Factory

选择器或决策器

Chooser
Selector
Mediator
Arbitrator
Decider
Allocator
Scheduler

处理器

Resolver
Processor
Handler
Executor

管理或控制器

Ruler
Controller
Manager
Ordinator
Leader
Master

单一功能

Loader
Parser
Register
Descriptor
Formatter
Marshaller / Unmarshaller
Encoder / Decoder
Counter
Viewer
Locator
Accumulator
Recognizer
Scroller
Printer
Compiler
Cleaner
Reader / Writer
Buffer
Transformer
Collector
Converter
Connector
Packer / Extractor
Scanner
Linker
Mapper
Streamer
Scheduler
Enhancer
Renderer
Painter
Weaver

Devenv UML ReverseEnginee:
class diagram:    1. 新建一个类库项目,将需要reverse enginee的dll进行引用
2. 新建一个modeliing项目
3. Ctrl+\, CTRL+R , Select files 选择dll文件

CamelCase,lowerCamelCase,UpperCamelCase(PascalCase)

Oracle表名长度要<30

Foreign key: delete rule -> cascade

mdf(主),ndf(第二个),ldf(日志): sql server数据库后缀名
sdf:sql server compact edition数据库后缀名

.net异步编程:
EAP: Event-based Asynchronous Pattern 基于事件的异步编程
IAsyncResult接口:Begin Method + End Method, End Mrthod作为Begin Method的一个参数被调用
Lambda: GetHostAddress(string hostName, Action<IPAddress> callback), 当另一个method调用GetHostAddress时,可以定义callback函数体,该callback函数体的会被嵌入到GetHostAddress中,从而实现了将外部的代码放到函数体内。
以上几种,如果exception是发生在回调函数中,那么就不会throw到caller中,造成debug困难
delegate, Action<>,Func<>: 是典型的用来定义回调函数体的对象
TAP: Task-based Asynchronous Pattern , Task: C#5.0新特性
await: compiler的特性,await OperateAsync()同一个语句块后的所有语句直到method结束,都被作为OperateAsync执行完后的回调函数。如果回调里面也有await,那么就再嵌套一个回调。
Task:代表一个异步操作,在操作完成后它有能力回调你定义的code(Task.ContinueWith()方法)。
async void; async Task; async Task<T>:
void: caller不能await,是典型的fire and forget操作,caller不知道操作是否完成,是否成功
Task: caller会等待异步操作完成,并且会传递发生在异步操作中的exception, 当Task不需要返回值时,async Task比async void要好,可以被caller await,可以处理exception。
异步lambda, delegate:
Func<Task<int>> getNumberAsync = async delegate { return 3; };
Func<Task<string>> getWordAsync = async () => “hello”;

timer exception: elapsed事件体中如果有异常,倘若是同步操作,那么该异常会被elapsed自身抓住,并且可以继续下一次循环,如果是异步操作,那么异常由于被await,跳出elapsed自身,会引起application错误,从而导致不会再触发下一次elapsed.

Visual Studio csproj文件中使用C#
<PropertyGroup Label=”SlowCheetah”>
<SlowCheetahToolsPath>$([System.IO.Path]::GetFullPath( $(MSBuildProjectDirectory)\..\packages\SlowCheetah.2.5.15\tools\))</SlowCheetahToolsPath>
<SlowCheetah_EnableImportFromNuGet Condition=” ‘$(SlowCheetah_EnableImportFromNuGet)’==” “>true</SlowCheetah_EnableImportFromNuGet>
<SlowCheetah_NuGetImportPath Condition=” ‘$(SlowCheetah_NuGetImportPath)’==” “>$([System.IO.Path]::GetFullPath( $(MSBuildProjectDirectory)\Properties\SlowCheetah\SlowCheetah.Transforms.targets ))</SlowCheetah_NuGetImportPath>
<SlowCheetahTargets Condition=” ‘$(SlowCheetah_EnableImportFromNuGet)’==’true’ and Exists(‘$(SlowCheetah_NuGetImportPath)’) “>$(SlowCheetah_NuGetImportPath)</SlowCheetahTargets>
</PropertyGroup>

alternate view:
<IMG src=’cid:img1’/>
linkedResource.ContentId=”img1

vs2013支持c#6.0的语法: Install-Package Microsoft.Net.Compilers

TCP: Listen -> Connect -> accept -> send/receive
UDP: send/receive directly.

netsh p2p : 查看p2p参数,修改参数
netsh /?:所有netsh命令

使程序集中的internal对象可以被指定的程序集发现
[assembly: InternalsVisibleTo(“CompanyName.ProductName.ComponentName.Database,PublicKey=0024000004800000940000000602000000240000525341310004000001000100e92a4f6095bd9f3ba64841aeb7cffe4aa97ec6b60ec80fd7faee51e964931612099537a76acd5d998d230be658c0abd2fde47d4622c89af6283e985e3a64e37ea0a31ab47aca8862ca556d321280186e06124b7bb593399b8b8c163e5870baf23256adad77da1686ee349add40eed62dc8e3a37309b5ee9cb89fee3ddd17dcbb”)]

使用sn命令,可以从dll文件中获得public key

.NET Standard mapping table
Platform Name     Alias
.NET Standard     netstandard     1.0     1.1     1.2     1.3     1.4     1.5     1.6
.NET Core     netcoreapp     →     →     →     →     →     →     1.0
.NET Framework     net     →     4.5     4.5.1     4.6     4.6.1     4.6.2     4.6.3
Mono/Xamarin Platforms         →     →     →     →     →     →     *
Universal Windows Platform     uap     →     →     →     →     10.0
Windows     win     →     8.0     8.1
Windows Phone     wpa     →     →     8.1
Windows Phone Silverlight     wp     8.0

nuget version control:
major number. minor number. patch number

Microsoft.Fake Framework UT mock数据

添加删除程序 列表在注册表中的位置
HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products
HKEY_CURRENT_USER\Software\Microsoft\Installer\Products
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall—-main
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall

Entity type与Complex type概念上的差别: entity 代表实体,是数据模型,通常应该有Key/Id标示符, 而complex不应该有key/Id

E2E(Endpoint to endpoint) Test: 端到端测试, 测试框架:NuwaFramework

debug nuget package pdb:
http://www.symbolsource.org/Public
https://nuget.smbsrc.net/
release: http://srv.symbolsource.org/pdb/Public
nightly: http://srv.symbolsource.org/pdb/MyGet

Leave a Reply

Your email address will not be published. Required fields are marked *