- 博客(189)
- 资源 (14)
- 收藏
- 关注
原创 ASP.NET Core读取appsettings.json的配置
在.net core中是没有*.config 文件的 配置文件都是*.json1、在project.json里下面这行代码"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",然后修改 appsettings.json 添加Redis配置 //用户配置信息
2017-01-13 14:42:42
3447
转载 .net core日志 NLog.Extensions.Logging
https://github.com/NLog/NLog.Extensions.Logging
2017-01-13 14:41:05
4161
原创 在ASP.NET Core Identity外面使用Cookie中间件
1、在 app.UseMvc 前面加上app.UseCookieAuthenticationapp.UseCookieAuthentication(new CookieAuthenticationOptions() { AuthenticationScheme = "IdeaCoreUser", LoginP
2017-01-13 14:40:40
2702
原创 在.net core中使用AutoMapper
1、新建一个类using AutoMapper;using YourModels;using YourViewModels;namespace YourNamespace{ public class AutoMapperProfileConfiguration : Profile { protected override void Configure()
2017-01-13 14:39:53
4720
原创 ASP.NET Core读取appsettings.json的配置
在.net core中是没有*.config 文件的 配置文件都是*.json1、在project.json里下面这行代码"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",然后修改 appsettings.json 添加Redis配置 //用户配置信息 "AppSet
2016-10-31 19:41:32
7706
原创 No executable found matching command "bower"
屏蔽project.json中的 scripts//"scripts": { // "prepublish": [ "bower install", "dotnet bundle" ], // "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish
2016-10-31 19:39:13
1534
原创 安装时报0x80070490 找不到元素
这里应该是vs只装了web没有装c++下载一个 VC_redist.x64.exe 安装就行了https://github.com/dotnet/core/issues/271
2016-10-31 19:38:38
20541
原创 .net core学习资料整理
官方网站:https://www.microsoft.com/net/core#windows官方文档:https://docs.asp.net/en/latest/intro.html中文翻译小组:http://www.cnblogs.com/dotNETCoreSG/p/aspnetcore-index.html发布到Jexus:ht
2016-10-31 19:38:11
4832
2
转载 Web API数据传输加密
1、Web API的接口访问分类Web API接口的访问方式,大概可以分为几类:1)一个是使用用户令牌,通过Web API接口进行数据访问。这种方式,可以有效识别用户的身份,为用户接口返回用户相关的数据,如包括用户信息维护、密码修改、或者用户联系人等与用户身份相关的数据。2)一种是使用安全签名进行数据提交。这种方式提交的数据,URL连接的签名参数是经过安全一定规则的加密的,
2015-08-18 12:03:12
41653
3
转载 【android】利用service监听来电或来信息
写这个东西只是为了练手,拍砖随意。反正自己也是菜鸟。微信/QQ在退出主界面之后还是会一直监听消息。如何实现呢?一下做的测试,监听为用户的新信息。首先:建立主程序界面<Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height=
2015-07-30 16:15:16
1347
原创 async和await异步操作
class Program { static void Main(string[] args) { // 同步方式 Console.WriteLine("异步方式测试开始!"); AstbcMethod(35); Console.WriteLine("异步方式结束!
2015-06-30 15:13:16
766
转载 .NET4.5之初识async与await
本人是从.NET4.0刚出的时候接触的.NET环境,所以学的东西就是4.0及其之前的。时代飞速前进,目测5.0也快出了吧,但一直也没去接受新的技术。最近由于要学习Web API,快看完了,却发现4.5已经大行其道了,于是又进行补脑。async与await便是其中之一: 这是两个关键字,用于异步编程。我们传统的异步编程方式一般是Thread、ThreadPool、BeginXXX、EndXXX等等
2015-06-30 15:09:40
4019
原创 属性路由参数约束
参考:点击打开链接ConstraintDescriptionExamplealphaMatches uppercase or lowercase Latin alphabet characters (a-z, A-Z){x:alpha}boolMatches a Boolean value.
2015-05-29 17:08:03
761
原创 使用Cookie来统计浏览次数,当天重复刷新不增加
var oldCookie = Request.Cookies["newsCookie"]; if (oldCookie == null) { var newsCookie = new HttpCookie("newsCookie"); newsCook
2015-04-14 17:45:18
2984
转载 实体框架配置节
实体框架允许从配置文件指定大量设置。一般来说,EF 遵循“约定先于配置”的原则。本文讨论的所有设置都有默认行为,您只需负责在默认值不再能够满足需求时更改设置。所有这些设置都可以使用代码来应用。配置文件选项可用于在部署期间轻松更改这些设置,而无需更新代码。 实体框架配置节从 EF4.1 开始,您可以使用配置文件的 appSettings 一节设置上下文的数据库初始值设
2015-03-12 09:39:31
790
原创 JS渲染
在web开发中经常会使用到 js 返回 json 数据,用字符串来拼接容易出错且可读性差那么可以使用 JsRender 来进行渲染http://www.jsviews.com/
2015-03-10 11:35:36
2968
原创 MVC EF学习碰到的问题
1、更改实体后报如下错误发生原因:因为程序运行时检测不到实体已更新,而调用的时候实体又跟数据库中不一样解决办法:在web.config中的 节点下加入 作为在Web.config中设置初始值设定项的替代文件是要在代码中通过将Database.SetInitializer语句添加到Global.asax.cs文件中的App
2015-03-06 11:04:25
995
原创 EF CodeFirst中Model变化时手动建表
/// /// 如果表不存在则创建表 /// /// public class CreateTablesIfNotExist : IDatabaseInitializer where TContext : DbContext { public void InitializeDatabase(TContext context)
2015-03-06 11:02:13
3496
原创 jQuery Validate 中的 remote
首先需要返回一个只存在 true 或 false 的json数据 /// /// 判断手机号是否已存在 /// /// /// public JsonResult IsExitMobile(string mobile) { var res = new JsonResu
2015-03-03 15:36:04
677
转载 线程池处理多线程
class Program { static void Main(string[] args) { const int FibonacciCalculations = 20; // One event is used for each Fibonacci object. ManualR
2015-02-12 10:38:36
433
原创 模块拖动
// 模块拖拽 $(function () { var _move = false;//移动标记 var _x, _y;//鼠标离控件左上角的相对位置 $(".ui-dialog-titlebar").click(function () { //alert("click");//点击(松开后触发) }).mousedown(funct
2015-02-09 09:17:49
619
原创 Js Div拖动
// 模块拖拽 $(function () { var _move = false;//移动标记 var _x, _y;//鼠标离控件左上角的相对位置 $(".ui-dialog-titlebar").click(function () { //alert("click");//点击(松开后触发) }).mousedown(funct
2015-02-06 13:46:09
479
原创 js参数不要直接传汉字,防止编码错误,转换成UniCode编码
C#转换UniCode方法/// /// 字符串转为UniCode码字符串 /// /// /// public static string StringToUnicode(string s) { char[] charbuffers = s.To
2015-01-22 14:53:42
2790
原创 textarea换行问题
Mvc中textarea文本换行@MvcHtmlString.Create(Model.CrowdfundDescribe.GoodAt.Replace("\r\n", ""))js中 textarea 文本换行.replace(/\n/g, '')
2015-01-22 14:50:36
812
原创 MVC操作 DropDownList
1、枚举转下拉框public static SelectList ToSelectList(this TEnum enumObj, bool markCurrentAsSelected = true, int[] valuesToExclude = null) where TEnum : struct { if (!typeof
2015-01-21 10:55:33
1053
转载 配置服务器流程
@打开防火墙,添加远程桌面端口号入站规则(远程端口号和后台端口号)http://jingyan.baidu.com/article/e9fb46e19ff8137521f7660c.html@修改远程桌面端口号http://jingyan.baidu.com/article/358570f67d22b2ce4624fc5f.html (重启后生效)@将A
2015-01-14 18:10:56
796
原创 返回Json格式在IE下会提示打开或下载
问题发现于 异步上传图片 返回结果在firefox、chrome正常,但是在ie下提示打开或下载解决办法:返回的json数据类型定义为 "text/html"return Json(new { Result = true, Obj = pluploadFileMod
2015-01-14 11:04:24
2797
原创 ModelState.IsValid 验证时忽略某些字段验证
BindAttribute 类忽略Model中Id的验证[Bind(Exclude = "Id")]
2014-12-15 14:57:42
7737
原创 2个不同数据库中表的数据导入
insert into xiercaifudb.dbo.Article (IsValid, CreateTime, UpdateTime, Title, Contents, IsHot, ArticleType, IsShow, Sort) select IsValid, CreateTime, UpdateTime, Title, Contents, IsHot, Articl
2014-09-12 10:18:55
1051
原创 Row_Number()
select ROW_NUMBER() Over(order by Id desc) as RowId,* from God
2014-09-09 09:38:21
488
原创 批量替换数据库中所有的 文字
如:将自有替换为喜儿declare @t varchar(255),@c varchar(255) declare table_cursor cursor for select a.name,b.name from sysobjects a,syscolumns b ,systypes c where a.id=b.id and a.xtype='u' and b.xtype=c.xty
2014-09-09 09:26:52
3072
原创 汉字转拼音帮助类(包含完整拼写和首字母拼写)
public static class PinyinHelper { private static readonly Hashtable PinyinHash; static PinyinHelper() { PinyinHash = new Hashtable {
2014-08-14 16:45:33
1275
转载 Twitter style paging with ASP.NET MVC and jQuery
public class HomeController : Controller{ private const int defaultEntryCount = 10; public ActionResult Index(int? entryCount) { if (!entryCount.HasValue) entryCount
2014-08-13 11:03:41
616
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人