LCD开发笔记-技术点总结

开发技术总结:
一、数据迁移
1、模型更改后:
1.1Enable-migrations
1.2修改实体对象
add-migration 修改的标记名称
1.3update-database
2、添加模型:
2.1将实体添加到上下文
add-migration 添加的标记名
update-database

二、规约
[Required]
[key.DatabaseGenerated(DatabaseGeneratedOption.Identity]
[MaxLength(15)]
[DatabaseGenerated(DataGeneratedOption.Identity]//新加入时
computed(更新时和加入时)
[Column(TypeName=”imgage”)]
http://www.cnblogs.com/Gyoung/archive/2013/01/17/2864150.html
三、日期时间
C# DateTime逊数的各种显示效果
http://blog.csdn.net/chwei_cson/article/details/7722233
http://blog.csdn.net/scimence/article/details/51488233
3.1默认时间
public DateTime createTime
{
get
{
return this.dateCreated.HasValue
? this.dateCreated.Value
: DateTime.Now;
}

        set { this.dateCreated = value; }

}

private DateTime? dateCreated = null;

3.2时间格式1
http://www.cnblogs.com/Pickuper/articles/2058880.html
DateTime dt;
DateTimeFormatInfo dtFormat=new System.Globalization.DateTimeFromateInfo();
dtFormat.ShortDatePattern=”yyy/mm/dd”
dt=convert.ToDateTime(“2017/05/26“,dtFormat);

3.3时间格式3
shared/displyTemplate/ShortDateTime
@model System.DateTime
@{
Layout = null;
}
@Model.ToShortDateString()
显示时:@Html.DisplayFor(modelItem=>item.Dostime,”LongDateTime”);

3.4时间格式4
http://blog.csdn.net/hmillet/article/details/51434564
[Display(Name=”publishTime”)]
[DisplayFormat(DataFormatString=”{0:yyyy/MM/dd}”]
public virtual System.DateTime PostTime
{
get;
set;
}
四、c# 使用Entity Framework操作Access数据库

Entity Framework是C#开发中最常见的ORM工具。默认Entity Framework只提供支持MSSQL的provider factory 。但是开发者开源贡献了对SQLite、MySql以及Access等的支持
JetEntityFrameworkProvider为Access数据库文件兼容Entity Framework提供了相应的 Provider 。在nuget中直接搜索JetEntityFrameworkProvider即可安装该工具

https://www.connectionstrings.com/ace-oledb-12-0/
http://blog.csdn.net/metal1/article/details/72820261
https://www.connectionstrings.com/ace-oledb-12-0/info-and-download/

DAL实例化
using JetEntityFrameworkProvider;
using System.Data.Entity.ModelConfiguration.Conventions;
namespace BMW.DAL
{
public class accessDbContext:DbContext
{
private static string con = WebConfigurationManager.ConnectionStrings[“DefaultConnection”].ConnectionString;

    ***public accessDbContext() : base(new JetConnection(con), true) { }***
    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        // base.OnModelCreating(modelBuilder);
        modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
    }
    }

web.config中



部署注意:
Framework4.5;
安装AccessDataBaseEngine.exe
配置windows\Microsoft.Net\framework\4.0…\config\machine.config

$(function () {   var id = '<%=itemid %>';   $.ajax({    type: "POST",    url: "/Student/GetItemTree",    data: { title: '<%=Model.Name %>', itemid: id, page: 1 },    beforeSend: function (data) { //取回数据前     $("#itemTree").html('<span style="padding:5">数据加载中...</span>');    },    error: function (data) { //发生错误时 //    debugger;    },    success: function (data) { //成功返回时     $("#itemTree").html(data);    }   }); 

八、Supporting OData Actions in ASP.NET Web API 2
https://docs.microsoft.com/en-us/aspnet/web-api/overview/odata-support-in-aspnet-web-api/odata-v3/odata-actions

九、背景的扩展
jquery-backstretch
https://github.com/jquery-backstretch/jquery-backstretch#transitions

十、服务器主动推送数据给客户端
10.1https://docs.microsoft.com/en-us/aspnet/signalr/index
10.2数据库触发
http://www.c-sharpcorner.com/blogs/the-sql-server-service-broker-for-the-current-database-is-not-enabled-and-as-a-result-query-notifications-are-not-supported-please-enable-the-service-broker-for-this-database-if-you-wish-to-use-not1
10.3教程
http://www.cnblogs.com/humble/p/3850749.html
10.4时时推送数据库的变化
http://blog.csdn.net/yanggenxiang/article/details/52415794
10.5单例模式的泛型实现 C#
http://blog.csdn.net/wuha555/article/details/40983297
https://www.2cto.com/kf/201412/363550.html

十一、C#之构造函数
http://www.cnblogs.com/jiajiayuan/archive/2011/09/08/2171422.html

十二、Html5+CSS3的响应式网页设计:自动适应屏幕
https://yusi123.com/2539.html

十三、MVC5通过HttpWebRequest上传图片
https://www.lanhusoft.com/Article/406.html

猜你喜欢

转载自blog.csdn.net/wyaspnet/article/details/79075347