学习笔记
EF添加视图主键问题解决方法:不要用全连连
linqToSql基类:
public class DataBaseContext : DataContext
{
private static string GetConnectionString
{
get
{
return Properties.Settings.Default.Maji_AnjianConnectionString;
}
}
public DataBaseContext():base(GetConnectionString)
{
}
public class BaseDal:DataBaseContext where T : class,new() { #region 增加 public string Add(T info) { try { // DataModelDataContext dc = new DataModelDataContext(ConnHelper.GetConnStr); this.GetTable().InsertOnSubmit(info);
this.SubmitChanges(); //执行插入操作
return "ok";
}
catch (Exception e)
{
return e.ToString();
}
}
}
//与12个月相关联
var dataResult = from month in periodMonth
join itm in data1 on month equals itm.Month
into allMonth
from m in allMonth.DefaultIfEmpty() //左连接如果itm没有数据,必须用data=m==null?0:m.filed
select new
{
// CarCode = m == null ? "" : m.CarCode,
Month = month,
LastKilo = m == null ? 0 : m.LastKilo,
Kilometers = m == null ? 0 : m.Kilometers,
Quantity = m == null ? 0 : m.Quantity,
Amount = m == null ? 0 : m.Amount,
查看iis里的进程
iisapp -a
vs2013 支持.net4.6 需要安装,Microsoft .NET Framework 4.6 Targeting Pack,网址: https://www.microsoft.com/en-us/download/details.aspx?id=48136