摘要:
In parts 1 and 2 of this series we looked at how to use DbContext.Database.Log to log the SQL generated by EF. But this code is actually a relatively thin façade over some low-level building blocks fo... 阅读全文
摘要:
In part 1 we saw how DbContext.Database.Log can be used to easily log SQL to the console or some other TextWriter. This post covers how the context and formatting of the output can be changed.Database... 阅读全文
摘要:
On the EF team we made a late decision to add some support for interception and logging of generated SQL in EF6. To this end recent checkins have added support for:A Log property for the context simil... 阅读全文
摘要:
1. const、readonly、static const修饰的字段表示是常量,其本质上在编译完成,执行之前其字段的真实值已经被写在了DLL中了。只有在声明的时候才能改变其值 readOnly表示只读的,其只有在声明的时候和构造函数中能被修改。通过编译后的代码可以看到,其实是在构造函数中赋值的 static静态的,在一个地方修改,对所有的对象都是有效的。其使用类名.字段名来... 阅读全文
摘要:
If you have ever had the need to store one or more possible values in a single field, you may have used the [Flags] attribute on an enum in C# which would look something like this:C#[Flags] public enu... 阅读全文