通过VS 2015+SVN为SQL Server提供数据库版本管理
对于一个软件企业来说,源代码就是公司全体智慧的结晶,绝不能有任何闪失。但对于公司产品的基石数据库怎么来进行统一管理呢?通常,是直接备份数据库文件的方式,或者生成数据库的部署脚本,来重复的备份。这个方法可行,却有些值得改进的地方。首先,太繁琐了,浪费精神;其二,不方便和其它项目同时管理。下面,就介绍我偶然看到的方法,当然,可能有很多人已经这么做了,但分享给那些还不知道的人。 大体思路: VS 2010 提供了一个项目类型,新建->数据库->SQL Server 2005 数据库对象 或 SQL Server 2...
Autofact IOC注入方式(二)
然后, 修改Global.asax, public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { //Autofac初始化过程 var builder = new ContainerBuilder(); builder.RegisterControllers(typeof(MvcApplication).Assembly);//注册所有的Controller //开发环境下,使用Stub类 builder.RegisterAssemblyTypes(typeof (MvcApplication).Assembly).Where( t => t.Name.En...
C#调用安全验证下的ActiveMQ REST管理接口
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Net; using System.IO; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { String url = textBox2.Text; ...
c# 反射赋值扩展方法
public static T ToModel<T>(this object source) where T : class, new() { var target = new T(); if (source == null) return null; foreach (var property in target.GetType().GetProperties()) { var sourceProterty = source.GetType().GetProperty(property.Name); if (sourceProterty == null) { continue; } var propertyValue = sourceProterty.GetValue(source, null); if (propertyValue != null) { //property.SetValue(target, i, null); target.GetType().InvokeMember(property.Na...
查看MVC EntityValidationErrors详细错误信息
关于如何查看 EntityValidationErrors 详细信息的解决方法 我们在 EF 的编程中,有时候会遇到这样一个错误: 但是,按照他的提示 “See 'EntityValidationErrors' property for more details.” 去 Exception 中查看,却只能看到 并不能看到具体的是那个属性为什么验证不通过,也许不少人都遇到这种情况。 这里给大家介绍一个Exception类,让我们能够轻松的知道具体的哪一个字段出了什么问题。 那就是 System.Data.Entity.Validation.DbEntityValidationException,相信代码都知道怎么写了,最简单的就是 try{// ...
VS2015装哪个版本比较好?企业版,专业版?
VS2015装哪个版本比较好?企业版,专业版? 各版本的详细功能比较图,自己点进去看看,企业版是最强的
在C#中使用PHPRPC
PHPRPC 是一个轻型的、安全的、跨网际的、跨语言的、跨平台的、跨环境的、跨域的、支持复杂对象传输的、支持引用参数传递的、支持内容输出重定向的、支持分级错误处理的、支持会话的、面向服务的高性能远程过程调用协议。 一个已经完成的访问量统计项目,发上来记录一下,服务端和客户端都使用C#编写 服务端代码: using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; u...
.NET中AOP的几种实现方案
AOP在.NET中的应用,个人也属于学习阶段,欢迎大家拍砖! 本文的例子模拟用户注册的场景,主要通过代码演示几种方案的实现方式。 静态代理 通过代理模式实现静态代理,大家一看代码基本就明白了。 用户注册接口和实现 public interface IUserProcessor { void RegUser(User user); } public class UserProcessor : IUserProcessor { public void RegUser(User user) { Console.WriteLine("用户已注册。Name:{0},PassWord:{1}", user.Name, user.PassWord); } } 通过静态编写代码的方式,装饰上面的用户注...
C#数组转字符串
C#数组转字符串 C#中的 Join方法和Split方法怎么用? 还有,怎么用join方法或者是Split方法来分割数组中的数据 Join和Split把原先需要循环解决的问题变成一个函数调用。 Split的作用是从一个字符串中,按分隔符取出各分量。 如: string testString = "James Hare,1001 Broadway Ave,St. Louis,MO,63101"; string[] results = testString.Split(new[] { ',' }); 执行后,数组results中的每个元素为串testString中用,分隔的每个分量。 Join则可以将各个分量,加上指定分隔符,合成一个字符串。 如: string[] parts...