风轻云淡

-------生活没有抱怨,只有自己的不努力,当才华撑不起梦想与野心,不断学习是你唯一的选择。没有伞的孩子必须努力奔跑...

导航

2020年6月21日 #

C# linq group by 异常 -----MySqlException: Unknown column 'GroupBy1.K1' in 'field list'

摘要: 使用Linq group by 查询 一般我们都会这样写Linq:var result = (from si in model.table group si by si.NumCores into grp orderby grp.Key select new CoreCount { Cores = 阅读全文

posted @ 2020-06-21 01:33 淡然→笑 阅读(356) 评论(0) 推荐(0) 编辑

2020年6月11日 #

System.InvalidOperationException: Unexpected connection state. When using a wrapping provider ensure that the StateChange event is implemented on the wrapped DbConnection.

摘要: System.InvalidOperationException: Unexpected connection state. When using a wrapping provider ensure that the StateChange event is implemented on the 阅读全文

posted @ 2020-06-11 16:58 淡然→笑 阅读(1129) 评论(2) 推荐(0) 编辑

2020年5月28日 #

Attaching an entity of type 'xxx' failed because another entity of the same type already has the same primary key value

摘要: Attaching an entity of type 'xxx' failed because another entity of the same type already has the same primary key value. This can happen when using th 阅读全文

posted @ 2020-05-28 13:40 淡然→笑 阅读(1712) 评论(0) 推荐(0) 编辑

EF保存数据报错:An entity object cannot be referenced by multiple instances of IEntityChangeTracker.

摘要: EF保存关联表报错:An entity object cannot be referenced by multiple instances of IEntityChangeTracker. 字面理解就是一个实例对象不能被多个IEntityChangeTracker实例对象引用 因为使用了Autofa 阅读全文

posted @ 2020-05-28 10:51 淡然→笑 阅读(280) 评论(0) 推荐(0) 编辑

2020年5月26日 #

SqlServer时间格式不足2位补0

摘要: CREATE FUNCTION [dbo].[FULL_TIME](@Times NVARCHAR(50)) RETURNS NVARCHAR(50) AS BEGIN DECLARE @return NVARCHAR(50) SET @return =( select case len(SUBST 阅读全文

posted @ 2020-05-26 18:29 淡然→笑 阅读(1928) 评论(0) 推荐(0) 编辑

2020年5月15日 #

windows服务/winform中使用Autofac依赖注入

摘要: 其实Windows服务使用autofac注入很简单,只需要简单的配置然后调用Build就可以。以下代码winform中同样可以用 /* .Net framework 4.5 Autofac 4.9.4.0 EF 6 App.config 中connectionStrings的配置和winform一样 阅读全文

posted @ 2020-05-15 10:11 淡然→笑 阅读(4754) 评论(2) 推荐(2) 编辑

2020年5月9日 #

C# Socket 处理 拆包、粘包

摘要: 1、采用TCP自定义协议通讯,协议由02(byte) + json字符串(byte[]) +03(byte)组成。 Socket_Client.cs 服务端using System;using System.Collections.Generic;using System.Net;using Sys 阅读全文

posted @ 2020-05-09 15:16 淡然→笑 阅读(1361) 评论(0) 推荐(0) 编辑

Autofac依赖注入之AuthorizeAttribute属性注入---.net framework 4.5 Mvc5 WebApi

摘要: 1、Webapi框架下使用Autofac属性注入之 AuthorizeAttribute的属性注入 public class MyAuthorizeAttribute : AuthorizeAttribute { public MyLog log { get; set; } //autofac注入的 阅读全文

posted @ 2020-05-09 11:55 淡然→笑 阅读(799) 评论(0) 推荐(0) 编辑

2020年4月13日 #

BitmapFactory.decodeStream返回null值 ,InputStream 被调用两次,第一次调用流被关闭清空了!!!

摘要: InputStream inputstrem =getContentResolver().openInputStream(图片Uri); //解码获取图片的宽高 BitmapFactory.Options options = new BitmapFactory.Options(); options. 阅读全文

posted @ 2020-04-13 15:13 淡然→笑 阅读(805) 评论(0) 推荐(0) 编辑

2020年3月18日 #

Android Studio开发---Get Post Put Delete 封装okhttp3类

摘要: package com.example.xxxxxx.com;import android.graphics.Bitmap;import android.graphics.BitmapFactory;import android.os.Handler;import android.os.Messag 阅读全文

posted @ 2020-03-18 13:46 淡然→笑 阅读(776) 评论(0) 推荐(0) 编辑