摘要:
1、model 注意点1:List<ProductSet> Products的Products必须继承ICollection<T>; 注意点2:ProductSet.CategoryID属性,要XXXXXID; [Table("ProductSet")] public class ProductSe 阅读全文
摘要:
1、EF关闭自动检测 Database.SetInitializer<EFDBContext>(null); 2、父类BaseDBContext public class BaseDBContext : DbContext { public BaseDBContext(string strConn 阅读全文
摘要:
如public IDbSet<User> ID { get; set; } 获取属性ID的类型是IDbSet<>,且泛型参数是User类型,代码如下 public Type[] GetAllRegEntityTypes() { var typeList = new List<Type>(); var 阅读全文
摘要:
今天看到一段代码,try中有return语句,后面还有一个finally,不知道执行过程是什么样的。于是来试验了一下。 1.try和catch中有return时,finally里面的语句会被执行吗 我们可以来分别看看 (1)执行try中的return时 public class tryDemo { 阅读全文
摘要:
using StackExchange.Redis; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Configuration; using Syst 阅读全文
摘要:
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Newtonsoft.Json; using StackExchange.Redis; nam 阅读全文
摘要:
1、ZipCompressionUtil using HRS.Lib.Comm.IO; using ICSharpCode.SharpZipLib.Checksums; using ICSharpCode.SharpZipLib.Zip; using System; using System.Col 阅读全文
摘要:
var str = "abcDEF"; switch (str) { case string x when x.StartsWith("abc"): Console.WriteLine("abc"); break; case string x when x.StartsWith("efc"): Co 阅读全文
摘要:
class Program { static void Main(string[] args) { for (int i = 0; i < 100; i++) { Thread t = new Thread(Test); t.Start(); } Console.Read(); } static v 阅读全文
摘要:
1、for循环:当闭包通过lambda表达式捕获可变变量时,lambda捕获变量的引用,而不是捕获该变量的当前值。因此,如果任务在变量的引用值更改后运行,则该值将是内存中最新的值,而不是捕获变量时的值。 for (int i = 0; i < 10; i++) { Task.Factory.Star 阅读全文
摘要:
public static class Program { public static void Main() { // 创建每2000ms就调用一次 TimerCallBack 方法的 Timer 对象 Timer t = new Timer(TimerCallBack, null, 0, 200 阅读全文