在Node.js中使用MongoDB少不了Mongoose. 假设有如下Mongoose Schemas的定义: var ItemSchema = new mongoose.Schema({ biz: String, name: String, tradeType: String, totalFee: Number, transactionId: String, createTime: { type: Date, default: Date.now }, updateTime: { type:…
本文转自:http://www.cnblogs.com/jaxu/p/5595451.html 在Node.js中使用MongoDB少不了Mongoose.假设有如下Mongoose Schemas的定义: var ItemSchema = new mongoose.Schema({ biz: String, name: String, tradeType: String, totalFee: Number, transactionId: String, createTime: { type:…
在C++开发当中经常用到宏的定义当中使用"#"或者"##",以下是对着两种符号使用方法的简单描述: define中的#就是把#后面的参数当做一个符号来使用,简单的说就是把它当做字符串连接起来,##连接前后2个符号, define定义中以#开头的宏直接替换不展开,以非#开头的宏先展开再替换. 如下: #define f(a,b) a##b #define d(a) #a #define s(a) d(a) puts(d(f(a,b))); 输出结果: f(a,b) p…
1.Preprocessor Glue: The ## Operator 预处理连接符:##操作符 Like the # operator, the ## operator can be used in the replacement section of a function-like macro.Additionally, it can be used in the replacement section of an object-like macro. The ## operator co…
今天在Visual Studio 2012中将页面布局打包到网站定义中. 新建Module “MasterPageGallary” 在Element中如下: <Elements xmlns="http://schemas.microsoft.com/sharepoint/"> <Module Name="MasterPageGallary" List="116" Url="_catalogs/masterpage&qu…
Spring MVC 中 @ModelAttribute 注解的妙用 Spring MVC 提供的这种基于注释的编程模型,极大的简化了 web 应用的开发.其中 @Controller 和 @RestController 注解的组件使用 @RequestMapping. @ExceptionHandler 等注解来表示请求映射,请求输入,异常处理等,使得开发者能专注于业务逻辑的编写,提高了开发效率. 带注释的控制器具有灵活的方法签名,不必扩展基类,也不需要实现特定的接口. 可以使用 Servle…
1.前言 选项(Options)模式是对配置(Configuration)的功能的延伸.在12章(ASP.NET Core中的配置二)Configuration中有介绍过该功能(绑定到实体类.绑定至对象图.将数组绑定至类)而选项模式又有个选项类(TOptions),该选项类作用是指:把选项类中的属性与配置来源中的键关联起来.举个例,假设json文件有个Option1键,选项类中也有个叫Option1的属性名,经过选项配置,这样就能把json中的键的值映射到选项类属性值中.也可以理解在项目应用中,…
原文:整理:C#中Expression表达式的妙用 一.目的:通过示例了解C#中Expression表达式的作用,通过表达式和反射可以写出很优雅的代码和架构,也可以完成一些看似不可能完成的任务 二.示例: 1.通过表达式获取成员属性 定义模型: [Description("唯一标识")] class PersonModel { [Description("唯一标识")] public string ID { get; set; } [Description(&quo…
vuex 第二篇:const store = new Vue.Store(option)中option选项.store实例对象的属性和方法 import Vuex from 'vuex' const store = new Vuex.Store(option) Vuex对象 option选项 store实例对象的属性 store实例对象的方法 Vuex 对象 在使用Vuex时,看下Vuex对象提供了哪些属性和方法. // vuex源码入口index.js export default { Sto…
.NetCore的配置选项建议结合在一起学习,不了解.NetCore 配置Configuration的同学可以看下我的上一篇文章 [.Net Core配置Configuration源码研究] 由代码开始 定义一个用户配置选项 public class UserOptions { private string instanceId; private static int index = 0; public UserOptions() { instanceId = (++index).ToStrin…