LCD开发笔记-技术点总结

news/2024/11/7 3:34:16/

开发技术总结:
一、数据迁移
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

<system.data>



</system.data>

五、C#对象与JSON格式

从一个Json串生成对象信息
using Newtonsoft.Json;
List processTimes = new List();
processTimes = JsonConvert.DeserializeObject<List>(cycleTime.timesJson.Substring(0, cycleTime.timesJson.Length));
return PartialView(processTimes);
view视图
@model IEnumerable<B.Models.ProcessTime>
@foreach (var item in Model)
{

@item.processNameEn
@item.processCode
@item.processTime

}
http://www.cnblogs.com/wangchuang/archive/2012/07/19/2599472.html

http://blog.csdn.net/xy_int/article/details/53608857

六、MVC控制器向View传值的三种方法
6.1把一个对象作为View方法的参数传递给视图
public ViewResult Index()
{
DateTime date = DateTime.Now;
return View(date);
}
view
@{
ViewBag.Title = “Index”;
}

Index

The day is: @(((DateTime)Model).DayOfWeek) 或 @model DateTime @{ ViewBag.Title = "Index"; }

Index

The day is: @Model.DayOfWeek

6.2使用ViewBag(视图包)传递数据
public ViewResult Index()
{
ViewBag.Message = “Hello”;
ViewBag.Date = DateTime.Now;
return View();
}

@{
ViewBag.Title = “Index”;
}
Index
The day is: @ViewBag.Date.DayOfWeek

The message is: @ViewBag.Message

6.3使用View Data传递数据
public ViewResult Index()
{
ViewData[“Message”] = “Hello”;
ViewData[“Date”] = DateTime.Now;
return View();
}
@{
ViewBag.Title = “Index”;
}

Index

The day is: @(((DateTime)ViewData["Date"]).DayOfWeek)

The message is: @ViewData["Message"]

七、Ajax Helper或Jquery异步加载部分视图
7.1通过jQuery异步加载部分视图
http://www.jb51.net/article/75584.htm
index.html
@section scripts {

页面刷新的方式加载部分视图方法包括:

Html.RenderPartial()
Html.RenderAction()

public ActionResult GetItemTree(string title, int itemid, int? page) { pp = new PagingParam(page ?? 1, VConfig.WebConstConfig.PageSize); Common.Page.PagedList<Entity.Res_Item_Resource_R> res_Item_Resource_R = iResourceService.GetRes_Item_Resource_RByItemId(itemid, pp); ViewData[“res_Item_Resource_R”] = res_Item_Resource_R; res_Item_Resource_R.AddParameters = new System.Collections.Specialized.NameValueCollection(); res_Item_Resource_R.AddParameters.Add(“title”, title); res_Item_Resource_R.AddParameters.Add(“itemid”, itemid.ToString()); ViewResult vr = new ViewResult { ViewData = ViewData, MasterName = “”, }; return vr; }

$(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
https://blog.csdn.net/qq_28368039/article/details/88350907
十一、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


http://www.ppmy.cn/news/777159.html

相关文章

LCD1602显示屏只亮不显示字符

代码能在普中的板子能正常显示&#xff0c;但是换了块板子就不行&#xff1a; 调节显示屏下方的可调电阻 在调试中找到自己适合的值&#xff0c;就可以看见字符了

L1-023 输出GPLT(Python实现) 测试点全过

题目 给定一个长度不超过10000的、仅由英文字母构成的字符串。请将字符重新调整顺序&#xff0c;按GPLTGPLT....这样的顺序输出&#xff0c;并忽略其它字符。当然&#xff0c;四种字符&#xff08;不区分大小写&#xff09;的个数不一定是一样多的&#xff0c;若某种字符已经输…

【转】随身HiFi 安卓OTG功能在音频上的妙用

原文网址&#xff1a;http://article.pchome.net/content-1745467.html 随身HiFi 安卓OTG功能在音频上的妙用 [PChome电脑之家音频频道原创]说起Android的OTG功能不知为何会让人想到NFC&#xff0c;它和NFC一样同样是经常被人忽略的一方面&#xff0c;笔者敢说有很多网友这两个…

浅谈DSD音频 是发展趋势还是厂商噱头

1DSD和现行的PCM截然不同 [PChome电脑之家音频频道原创]随着索尼Hi-Res Audio概念的提出以及近期一些支持DSD解码设备的上市&#xff0c;DSD的曝光率似乎又高了起来&#xff0c;同时这也勾起了无数发烧友的好奇心&#xff0c;现今有很多厂商都以此作为宣传和卖点&#xff0c;声…

php界面框架luy_May 18:PHP (了解一下,25种框架)

1、Laravel Laravel是一个简单优雅的PHPWeb开发框架&#xff0c;可以将开发者从意大利面条式的代码中解放出来&#xff0c;通过简单、高雅、表达式语法开发出很棒的Web应用&#xff0c;Laravel拥有更富有表现力的语法、高质量的文档、丰富的扩展包&#xff0c;被称为“巨匠级PH…

测试听力 html,听力测试,看看你的耳朵听力受损了没

41# Lai: 今天用AU做噪声分析偶然发现自己14k以上完全听不到了(14K以上噪声很小)&#xff0c;吓得我以为天塌了。来博主这里测试发现正常听音音量到18K左右都没问题&#xff0c;一个视频那里可以听到18秒&#xff0c;19秒就听不见了。16K及以上右耳比较敏感。19K及以上得开70%的…

PCM音频数据、DSD音频数据,DOP及spdif

PCM音频数据、DSD音频数据&#xff0c;DOP及spdif 一、PCM二、DSD三、DOP四、SPDIF 本文引用&#xff1a; http://article.pchome.net/pic-1717286-1.html http://www.360doc.com/content/17/0929/09/46862318_691041839.shtml https://www.zhihu.com/question/393437399/ans…

【翻译】Real-Time High-Resolution Background Matting

实时高分辨率抠图&#xff0c;Real-Time High-Resolution Background Matting原论文地址 图 1&#xff1a;当前的视频会议工具&#xff08;如 Zoom&#xff09;可以获取输入源&#xff08;左&#xff09;并替换背景&#xff0c;通常会引入伪影&#xff0c;如中间结果所示&#…