(T arg, string name) where T : class
-{
- if (arg == null)
- {
- throw new ArgumentNullException(name);
- }
-}
-#>
\ No newline at end of file
diff --git a/Project/Controller/CustomerController.cs b/Project/Controller/CustomerController.cs
index 014807d..957ae68 100644
--- a/Project/Controller/CustomerController.cs
+++ b/Project/Controller/CustomerController.cs
@@ -49,8 +49,8 @@ namespace Project
var itemcnt = 0;
if (searchkey.isEmpty() == false)
{
- var db = new EEEntitiesCommon();
- var rows = db.Customs.Where(t => t.gcode == FCOMMON.info.Login.gcode).OrderBy(t => t.name);
+ var db = new dsMSSQLTableAdapters.CustomsTableAdapter();//.custrom EEEntitiesCommon();
+ var rows = db.GetData(FCOMMON.info.Login.gcode);// db.Customs.Where(t => t.gcode == FCOMMON.info.Login.gcode).OrderBy(t => t.name);
itemcnt = rows.Count();
foreach (var item in rows)
{
@@ -138,9 +138,9 @@ namespace Project
var itemcnt = 0;
//if (searchkey.isEmpty() == false)
{
- var db = new EEEntitiesCommon();
+ var db = new dsMSSQLTableAdapters.CustomsTableAdapter();// EEEntitiesCommon();
var sd = DateTime.Now.ToString("yyyy-MM-01");
- var rows = db.Customs.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode).OrderBy(t=>t.name);
+ var rows = db.GetData(FCOMMON.info.Login.gcode);// .Customs.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode).OrderBy(t=>t.name);
itemcnt = rows.Count();
foreach (var item in rows)
{
diff --git a/Project/Controller/ItemController.cs b/Project/Controller/ItemController.cs
index f360359..a92d9e5 100644
--- a/Project/Controller/ItemController.cs
+++ b/Project/Controller/ItemController.cs
@@ -2,6 +2,7 @@
using System.Linq;
using System.Net.Http;
using System.Web.Http;
+using System.Windows.Forms;
namespace Project
{
@@ -43,6 +44,11 @@ namespace Project
//기본값을 찾아서 없애줘야한다
var searchkey = string.Empty;
if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim();
+ if (searchkey.isEmpty() == false && searchkey != "%")
+ {
+ if (searchkey.StartsWith("%") == false) searchkey = "%" + searchkey;
+ if (searchkey.EndsWith("%") == false) searchkey = searchkey + "%";
+ }
var tbody = new System.Text.StringBuilder();
@@ -50,8 +56,8 @@ namespace Project
var itemcnt = 0;
if (searchkey.isEmpty() == false)
{
- var db = new EEEntitiesMain();
- var rows = db.vFindSID.Where(t => t.sid.Contains(searchkey) || t.name.Contains(searchkey) || t.model.Contains(searchkey));
+ var db = new dsMSSQLTableAdapters.vFindSIDTableAdapter();// EEEntitiesMain();
+ var rows = db.GetData(searchkey);// .vFindSID.Where(t => t.sid.Contains(searchkey) || t.name.Contains(searchkey) || t.model.Contains(searchkey));
itemcnt = rows.Count();
foreach (var item in rows)
{
@@ -61,15 +67,15 @@ namespace Project
tbody.AppendLine($"| {item.name} | ");
tbody.AppendLine($"{item.model} | ");
- if (item.price == null)
+ if (item.IspriceNull())
tbody.AppendLine($"-- | ");
else
{
var price = (double)item.price / 1000.0;
-
+
tbody.AppendLine($"{price.ToString("N0")} | ");
}
-
+
tbody.AppendLine($"{item.manu} | ");
tbody.AppendLine($"{item.supply} | ");
diff --git a/Project/Controller/JobreportController.cs b/Project/Controller/JobreportController.cs
index a5f436b..d5d8e5e 100644
--- a/Project/Controller/JobreportController.cs
+++ b/Project/Controller/JobreportController.cs
@@ -68,10 +68,10 @@ namespace Project
var tbody = new System.Text.StringBuilder();
//테이블데이터생성
- var db = new EEEntitiesJobreport();
+ var db = new dsMSSQLTableAdapters.vJobReportForUserTableAdapter();//. EEEntitiesJobreport();
var sd = DateTime.Now.ToString("yyyy-MM-01");
var ed = DateTime.Now.ToShortDateString();
- var rows = db.vJobReportForUser.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode && t.idx == id).FirstOrDefault();
+ var rows = db.GetData(FCOMMON.info.Login.gcode, id).FirstOrDefault();//.vJobReportForUser.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode && t.idx == id).FirstOrDefault();
var contents = result.Content;
if (rows == null)
@@ -140,10 +140,11 @@ namespace Project
var itemcnt = 0;
//if (searchkey.isEmpty() == false)
{
- var db = new EEEntitiesJobreport();
+ var db = new dsMSSQLTableAdapters.vJobReportForUserTableAdapter();// EEEntitiesJobreport();
var sd = DateTime.Now.ToString("yyyy-MM-01");
var ed = DateTime.Now.ToShortDateString();
- var rows = db.vJobReportForUser.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode && t.id == FCOMMON.info.Login.no && t.pdate.CompareTo(sd) >= 0 && t.pdate.CompareTo(ed) <= 1).OrderByDescending(t => t.pdate);
+ var rows = db.GetByDate(FCOMMON.info.Login.gcode, FCOMMON.info.Login.no, sd, ed);
+ //vJobReportForUser.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode && t.id == FCOMMON.info.Login.no && t.pdate.CompareTo(sd) >= 0 && t.pdate.CompareTo(ed) <= 1).OrderByDescending(t => t.pdate);
itemcnt = rows.Count();
foreach (var item in rows)
{
@@ -228,9 +229,9 @@ namespace Project
var itemcnt = 0;
if (searchkey.isEmpty() == false)
{
- var db = new EEEntitiesJobreport();
+ var db = new dsMSSQLTableAdapters.vJobReportForUserTableAdapter();// EEEntitiesJobreport();
var sd = DateTime.Now.ToShortDateString();
- var rows = db.vJobReportForUser.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.pdate.CompareTo(sd) == 0).OrderBy(t => t.name);
+ var rows = db.GetByToday(FCOMMON.info.Login.gcode, sd);//.vJobReportForUser.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.pdate.CompareTo(sd) == 0).OrderBy(t => t.name);
itemcnt = rows.Count();
foreach (var item in rows)
{
@@ -309,10 +310,11 @@ namespace Project
var itemcnt = 0;
//if (searchkey.isEmpty() == false)
{
- var db = new EEEntitiesJobreport();
+ var db = new dsMSSQLTableAdapters.vJobReportForUserTableAdapter();// EEEntitiesJobreport();
var sd = DateTime.Now.ToShortDateString();
var ed = DateTime.Now.ToShortDateString();
- var rows = db.vJobReportForUser.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode && t.id == FCOMMON.info.Login.no && t.pdate.CompareTo(sd) >= 0 && t.pdate.CompareTo(ed) <= 1).OrderByDescending(t => t.pdate);
+ var rows = db.GetByDate(FCOMMON.info.Login.gcode, FCOMMON.info.Login.no, sd, ed);
+ //.vJobReportForUser.AsNoTracking().Where(t => t.gcode == FCOMMON.info.Login.gcode && t.id == FCOMMON.info.Login.no && t.pdate.CompareTo(sd) >= 0 && t.pdate.CompareTo(ed) <= 1).OrderByDescending(t => t.pdate);
itemcnt = rows.Count();
foreach (var item in rows)
{
diff --git a/Project/Controller/ProjectController.cs b/Project/Controller/ProjectController.cs
index acef50c..72c2295 100644
--- a/Project/Controller/ProjectController.cs
+++ b/Project/Controller/ProjectController.cs
@@ -50,25 +50,25 @@ namespace Project
var itemcnt = 0;
if (searchkey.isEmpty() == false)
{
- var db = new EEEntitiesProject();
+ //var db = new EEEntitiesProject();
- var rows = db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.status.Contains("완료") == false).OrderByDescending(t => t.pdate).Take(50);
+ //var rows = db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.status.Contains("완료") == false).OrderByDescending(t => t.pdate).Take(50);
- itemcnt = rows.Count();
- foreach (var item in rows)
- {
- tbody.AppendLine("");
- tbody.AppendLine($"| {item.pdate} | ");
- tbody.AppendLine($"{item.name} | ");
+ //itemcnt = rows.Count();
+ //foreach (var item in rows)
+ //{
+ // tbody.AppendLine("
");
+ // tbody.AppendLine($"| {item.pdate} | ");
+ // tbody.AppendLine($"{item.name} | ");
- //if (item.description.Length > 10)
- // tbody.AppendLine($"{item.description.Substring(0, 10)}... | ");
- //else
- // tbody.AppendLine($"{item.description} | ");
- tbody.AppendLine("
");
- }
+ // //if (item.description.Length > 10)
+ // // tbody.AppendLine($"{item.description.Substring(0, 10)}... | ");
+ // //else
+ // // tbody.AppendLine($"{item.description} | ");
+ // tbody.AppendLine("");
+ //}
}
//아잍쳄이 없는경우
@@ -114,9 +114,11 @@ namespace Project
var project = (int)id;
//데이터를 조회해서 표시를 해준다.
- var db = new EEEntitiesProject();
- var prjinfo = db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.idx == project).FirstOrDefault();
- var schrows = db.EETGW_ProjectsSchedule.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.project == project).OrderByDescending(t => t.project).OrderByDescending(t => t.no).OrderBy(t => t.seq);
+ var db = new dsProjectsTableAdapters.ProjectsTableAdapter();// EEEntitiesProject();
+ var prjinfo = db.GetData(FCOMMON.info.Login.gcode, project).FirstOrDefault();// db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.idx == project).FirstOrDefault();
+
+ var taSch = new dsProjectsTableAdapters.EETGW_ProjectsScheduleTableAdapter();
+ var schrows = taSch.GetData(FCOMMON.info.Login.gcode, project);//. db.EETGW_ProjectsSchedule.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.project == project).OrderByDescending(t => t.project).OrderByDescending(t => t.no).OrderBy(t => t.seq);
var gets = Request.GetQueryNameValuePairs();// GetParameters(data);
@@ -197,10 +199,10 @@ namespace Project
//if (searchkey.isEmpty() == false)
{
- var db = new EEEntitiesProject();
+ var db = new dsProjectsTableAdapters.ProjectsTableAdapter();// EEEntitiesProject();
- var rows = db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.status.Contains("완료") == false).OrderByDescending(t => t.pdate).Take(50);
+ var rows = db.GetNotCompleteTop50(FCOMMON.info.Login.gcode);//.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.status.Contains("완료") == false).OrderByDescending(t => t.pdate).Take(50);
itemcnt = rows.Count();
foreach (var item in rows)
@@ -290,10 +292,10 @@ namespace Project
//if (searchkey.isEmpty() == false)
{
- var db = new EEEntitiesProject();
+ var db = new dsProjectsTableAdapters.ProjectsTableAdapter();// EEEntitiesProject();
- var rows = db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.status.Contains("완료") == false).OrderByDescending(t => t.pdate).Take(50);
+ var rows = db.GetNotCompleteTop50(FCOMMON.info.Login.gcode);// db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.status.Contains("완료") == false).OrderByDescending(t => t.pdate).Take(50);
itemcnt = rows.Count();
foreach (var item in rows)
@@ -388,9 +390,9 @@ namespace Project
//if (searchkey.isEmpty() == false)
{
- var db = new EEEntitiesProject();
+ var db = new dsProjectsTableAdapters.ProjectsTableAdapter();// EEEntitiesProject();
- var prjinfo = db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.idx == id).FirstOrDefault();
+ var prjinfo = db.GetData(FCOMMON.info.Login.gcode, id).FirstOrDefault();// db.Projects.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.idx == id).FirstOrDefault();
System.Text.StringBuilder tinfo = new System.Text.StringBuilder();
//프로젝트정보를 표시합니다.
tinfo.AppendLine("");
@@ -405,8 +407,8 @@ namespace Project
contents = contents.Replace("{tableinfo}", tinfo.ToString());
-
- var rows = db.ProjectsPart.Where(t => t.Project == id).OrderBy(t=>t.no);
+ var taPart = new dsProjectsTableAdapters.ProjectsPartTableAdapter();
+ var rows = taPart.GetData(id);// db.ProjectsPart.Where(t => t.Project == id).OrderBy(t=>t.no);
itemcnt = rows.Count();
foreach (var item in rows)
diff --git a/Project/Controller/PurchaseController.cs b/Project/Controller/PurchaseController.cs
index abdd11f..f2d1512 100644
--- a/Project/Controller/PurchaseController.cs
+++ b/Project/Controller/PurchaseController.cs
@@ -2,6 +2,7 @@
using System.Linq;
using System.Net.Http;
using System.Web.Http;
+using System.Windows.Forms;
namespace Project
{
@@ -44,14 +45,20 @@ namespace Project
var searchkey = string.Empty;
if (key_search.Key != null && key_search.Value.isEmpty() == false) searchkey = key_search.Value.Trim();
+ if(searchkey.isEmpty()==false && searchkey != "%")
+ {
+ if (searchkey.StartsWith("%") == false) searchkey = "%" + searchkey;
+ if (searchkey.EndsWith("%") == false) searchkey += "%";
+ }
+
var tbody = new System.Text.StringBuilder();
//테이블데이터생성
var itemcnt = 0;
if (searchkey.isEmpty() == false)
{
- var db = new EEEntitiesMain();
- var rows = db.vFindSID.Where(t => t.sid.Contains(searchkey) || t.name.Contains(searchkey) || t.manu.Contains(searchkey) || t.model.Contains(searchkey));
+ var db = new dsMSSQLTableAdapters.vFindSIDTableAdapter();// EEEntitiesMain();
+ var rows = db.GetData(searchkey);//.vFindSID.Where(t => t.sid.Contains(searchkey) || t.name.Contains(searchkey) || t.manu.Contains(searchkey) || t.model.Contains(searchkey));
itemcnt = rows.Count();
foreach (var item in rows)
{
@@ -61,7 +68,7 @@ namespace Project
tbody.AppendLine($"| {item.name} | ");
tbody.AppendLine($"{item.model} | ");
- if (item.price == null)
+ if (item.IspriceNull())
tbody.AppendLine($"-- | ");
else
{
@@ -139,11 +146,11 @@ namespace Project
var itemcnt = 0;
//if (searchkey.isEmpty() == false)
//{
- var db = new EEEntitiesPurchase();
+ var db = new dsMSSQLTableAdapters.vPurchaseTableAdapter();// EEEntitiesPurchase();
var sd = DateTime.Now.ToString("yyyy-MM-01");
- var rows = db.vPurchase.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.pdate.CompareTo(sd) >= 0).OrderByDescending(t => t.pdate);
+ var rows = db.GetAfter(FCOMMON.info.Login.gcode, sd);// .vPurchase.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.pdate.CompareTo(sd) >= 0).OrderByDescending(t => t.pdate);
itemcnt = rows.Count();
- foreach (vPurchase item in rows)
+ foreach (var item in rows)
{
tbody.AppendLine("
");
tbody.AppendLine($"| {item.pdate.Substring(5)} | ");
diff --git a/Project/Customs.cs b/Project/Customs.cs
deleted file mode 100644
index 264fda9..0000000
--- a/Project/Customs.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 이 코드는 템플릿에서 생성되었습니다.
-//
-// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
-// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
-//
-//------------------------------------------------------------------------------
-
-namespace Project
-{
- using System;
- using System.Collections.Generic;
-
- public partial class Customs
- {
- public int idx { get; set; }
- public string gcode { get; set; }
- public string grp { get; set; }
- public string uptae { get; set; }
- public string name { get; set; }
- public string name2 { get; set; }
- public string owner { get; set; }
- public string ownertel { get; set; }
- public string address { get; set; }
- public string tel { get; set; }
- public string fax { get; set; }
- public string email { get; set; }
- public string memo { get; set; }
- public string staff { get; set; }
- public string stafftel { get; set; }
- public string wuid { get; set; }
- public System.DateTime wdate { get; set; }
- }
-}
diff --git a/Project/DSMail.xsd b/Project/DSMail.xsd
index 896a394..50b1a28 100644
--- a/Project/DSMail.xsd
+++ b/Project/DSMail.xsd
@@ -2,9 +2,10 @@
-
+
+
@@ -481,7 +482,7 @@ WHERE (gcode = @gcode) AND (project = @project)
-
+
SELECT id, MAX(name) AS name
@@ -665,7 +666,7 @@ SELECT idx, pdate, free, memo, wuid, wdate FROM HolidayLIst WHERE (idx = @idx)
-
+
SELECT gcode, dept, level, name, nameE, grade, email, tel, indate, outdate, hp, place, ads_employNo, ads_title, ads_created, memo, processs, id, state, useJobReport, useUserState, password
@@ -703,7 +704,7 @@ WHERE (gcode = @gcode)
-
+
SELECT gcode, dept, level, name, nameE, grade, email, tel, indate, outdate, hp, place, ads_employNo, ads_title, ads_created, memo, processs, id, state, useJobReport, useUserState, password
@@ -747,13 +748,13 @@ ORDER BY pdate
-
+
-
+
-
+
@@ -820,14 +821,14 @@ ORDER BY pdate
-
+
-
+
@@ -845,11 +846,11 @@ ORDER BY pdate
-
+
-
-
+
+
@@ -921,7 +922,7 @@ ORDER BY pdate
-
+
@@ -929,23 +930,23 @@ ORDER BY pdate
-
+
-
+
-
+
-
+
-
+
@@ -1016,19 +1017,19 @@ ORDER BY pdate
-
-
+
+
-
+
-
+
@@ -1045,7 +1046,7 @@ ORDER BY pdate
-
+
@@ -1112,14 +1113,14 @@ ORDER BY pdate
-
+
-
+
-
+
@@ -1196,17 +1197,17 @@ ORDER BY pdate
-
+
-
+
-
+
-
+
@@ -1223,10 +1224,10 @@ ORDER BY pdate
-
+
-
+
@@ -1241,7 +1242,7 @@ ORDER BY pdate
-
+
@@ -1293,8 +1294,8 @@ ORDER BY pdate
-
-
+
+
@@ -1303,7 +1304,7 @@ ORDER BY pdate
-
+
@@ -1342,14 +1343,14 @@ ORDER BY pdate
-
+
-
+
-
+
@@ -1365,18 +1366,18 @@ ORDER BY pdate
-
+
-
+
-
+
@@ -1518,10 +1519,10 @@ ORDER BY pdate
-
+
-
+
diff --git a/Project/DSMail.xss b/Project/DSMail.xss
index 3f71a35..69acd94 100644
--- a/Project/DSMail.xss
+++ b/Project/DSMail.xss
@@ -4,7 +4,7 @@
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
-->
-
+
@@ -12,8 +12,8 @@
-
-
+
+
diff --git a/Project/DSQuery.xss b/Project/DSQuery.xss
index dbc2606..6924191 100644
--- a/Project/DSQuery.xss
+++ b/Project/DSQuery.xss
@@ -6,7 +6,7 @@
-->
-
+
\ No newline at end of file
diff --git a/Project/Dialog/fLogin.cs b/Project/Dialog/fLogin.cs
index dbb6c76..5b9ffab 100644
--- a/Project/Dialog/fLogin.cs
+++ b/Project/Dialog/fLogin.cs
@@ -26,7 +26,7 @@ namespace Project.Dialog
};
this.Text = string.Format("사용자 확인(v{0})", Application.ProductVersion);
- var lv = this.listView1.Items.Add("[25-04-06] 데이터베이스가 이전 작업 완료");
+ var lv = this.listView1.Items.Add("[25-04-06] 데이터베이스 이전 작업 완료 (버그신고:chikyun.kim@amkor.co.kr)");
lv.Tag = "기존 데이터베이스 삭제 예정으로 인한 신규 데이터베이스 업데이트 작업 완료\n일부 기능에 문제가 발생할 수 있습니다. 문제 발생시에는 chikyun.kim@amkor.co.kr 로 문의 주세요";
}
private void fLogin_Load(object sender, EventArgs e)
@@ -53,7 +53,9 @@ namespace Project.Dialog
//그룹목록가져오기
+ //Util.MsgE(Properties.Settings.Default.CS);
var tagrp = new dsMSSQLTableAdapters.UserGroupTableAdapter();
+ //Util.MsgE(tagrp.Connection.ConnectionString);
var grplist = tagrp.GetData();
this.cmbDept.DataSource = grplist;
this.cmbDept.DisplayMember = "dept";
@@ -139,14 +141,14 @@ namespace Project.Dialog
{
var taGrpUser = new dsMSSQLTableAdapters.EETGW_GroupUserTableAdapter();
var drGrpUser = taGrpUser.GetbyID(gCode, id).FirstOrDefault();
- if(drGrpUser == null)
+ if (drGrpUser == null)
{
Util.MsgE($"입력한 사용자 계정이 존재하지 않습니다\n\n담당부서명:{cmbDept.Text}\n부서코드:{gCode}\n\n접속 부서를 확인하시고 관리자 문의 하세요");
tbPW.SelectAll();
tbPW.Focus();
return;
}
- else if(drGrpUser.level == 0)
+ else if (drGrpUser.level == 0)
{
Util.MsgE($"해당 계정이 활성화되지 않았습니다\n계정 담당자 문의하세요");
tbPW.SelectAll();
@@ -157,14 +159,14 @@ namespace Project.Dialog
//사용자테이블에서 암호를 확인합니다.
var taUser = new dsMSSQLTableAdapters.UsersTableAdapter();
var drUser = taUser.GetID(id).FirstOrDefault();
- if(drUser == null)
+ if (drUser == null)
{
Util.MsgE($"입력한 사용자 계정이 존재하지 않습니다\n\n담당부서명:{cmbDept.Text}\n부서코드:{gCode}\n\n접속 부서를 확인하시고 관리자 문의 하세요");
tbPW.SelectAll();
tbPW.Focus();
return;
}
- else if(drUser.password.Equals(encpass)==false)
+ else if (drUser.password.Equals(encpass) == false)
{
Util.MsgE($"암호가 일치하지 않습니다.\n암호를 분실했을 경우에는 계정담당자에 초기화를 요청 하세요");
tbPW.SelectAll();
@@ -272,34 +274,37 @@ namespace Project.Dialog
{
//누군가가 로그인하면 당일 자동 생성되어야할 유저의 데이터를 기록한다.
- var dbi = new EEEntitiesMain();
- var db = new EEEntitiesMain();
+ var dbAI = new dsMSSQLTableAdapters.EETGW_JobReport_AutoInputTableAdapter();// EEEntitiesMain();
+ var dbGU = new dsMSSQLTableAdapters.vGroupUserTableAdapter();// EEEntitiesMain();
+ var dbHL = new dsMSSQLTableAdapters.HolidayLIstTableAdapter();
+ var dbJR = new dsMSSQLTableAdapters.JobReportTableAdapter();
+ var taQuery = new DSQueryTableAdapters.QueriesTableAdapter();
+
var nd = DateTime.Now.ToShortDateString();
//이 날짜가 휴일인지 체크한다.
- var Holyinfo = db.HolidayLIst.Where(t => t.pdate == nd).FirstOrDefault();
- if (Holyinfo != null && Holyinfo.free != null && (bool)(Holyinfo.free)) return;
+ var Holyinfo = dbHL.GetData(nd).FirstOrDefault();// db.HolidayLIst.Where(t => t.pdate == nd).FirstOrDefault();
+ if (Holyinfo != null && Holyinfo.IsfreeNull() == false && Holyinfo.free == true) return;
//토,일은 처리하지 않음
if (DateTime.Now.DayOfWeek == DayOfWeek.Saturday || DateTime.Now.DayOfWeek == DayOfWeek.Sunday) return;
+ // db.EETGW_JobReport_AutoInput.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.enable == true && t.autoinput == "A" && t.pdate.CompareTo(nd) <= 0 && (string.IsNullOrEmpty(t.edate) == true || t.edate.CompareTo(nd) > 0));
+ var rows = dbAI.GetActiveList(info.Login.gcode, "A", "%", nd);
- var rows = db.EETGW_JobReport_AutoInput.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.enable == true && t.autoinput == "A" && t.pdate.CompareTo(nd) <= 0 && (string.IsNullOrEmpty(t.edate) == true || t.edate.CompareTo(nd) > 0));
foreach (var dr in rows)
{
//퇴사자 확인
- var userdata = db.vGroupUser.Where(t => t.id == dr.uid).FirstOrDefault();
- if (userdata != null && string.IsNullOrEmpty(userdata.outdate) == false) continue;
-
-
-
+ var userdata = dbGU.GetByID(FCOMMON.info.Login.gcode, dr.uid).FirstOrDefault();// db.vGroupUser.Where(t => t.id == dr.uid).FirstOrDefault();
+ if (userdata != null && userdata.IsoutdateNull() == false) continue;
//오늘자 자동생성된 데이터가 있다면 처리하지 않는다
- if (db.JobReport.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.pdate == nd && t.uid == dr.uid && t.autoinput == true).Any()) continue;
+ if (taQuery.ExistAutoInputData(info.Login.gcode, dr.uid, nd) > 0) continue; //db.JobReport.Where(t => t.gcode == FCOMMON.info.Login.gcode && t.pdate == nd && t.uid == dr.uid && t.autoinput == true).Any())
//이데이터를 그대로 생성해준다.
- var newdr = new JobReport();
+ var dtjr = new dsMSSQL.JobReportDataTable();
+ var newdr = dtjr.NewJobReportRow();
newdr.gcode = FCOMMON.info.Login.gcode;
newdr.wuid = dr.uid;// FCOMMON.info.Login.no;
newdr.wdate = DateTime.Now;
@@ -320,12 +325,14 @@ namespace Project.Dialog
newdr.status = dr.status;
newdr.tag = dr.tag;
newdr.uid = dr.uid;
- dbi.JobReport.Add(newdr);
- dbi.SaveChanges();
+ dtjr.AddJobReportRow(newdr);
+ dbJR.Update(dtjr);
}
- dbi.Dispose();
- db.Dispose();
-
+ dbAI.Dispose();
+ dbGU.Dispose();
+ dbHL.Dispose();
+ dbJR.Dispose();
+ taQuery.Dispose();
}
///
@@ -339,12 +346,12 @@ namespace Project.Dialog
var taQ = new DSQueryTableAdapters.QueriesTableAdapter();
var exist = taQ.ExistAutoInputData(info.Login.gcode, info.Login.no, nd) > 0;
- var db = new EEEntitiesMain();
-
+ //var db = new EEEntitiesMain();
+
if (exist == false)
{
var taM = new dsMSSQLTableAdapters.EETGW_JobReport_AutoInputTableAdapter();
- var rows = taM.GetActiveList(info.Login.gcode, info.Login.no, nd);
+ var rows = taM.GetActiveList(info.Login.gcode, "L", info.Login.no, nd);
//var rows = db.EETGW_JobReport_AutoInput.Where(t => t.gcode == FCOMMON.info.Login.gcode &&
//t.enable == true &&
@@ -468,7 +475,7 @@ namespace Project.Dialog
if (dlg != DialogResult.Yes) return;
var f = new _Common.fAddNewUser(cmbDept.Text, string.Empty, 0);//.fUserInfo();
dlg = f.ShowDialog();
- if(dlg == DialogResult.OK)
+ if (dlg == DialogResult.OK)
{
tbID.Text = f.tbId.Text.Trim();
}
@@ -480,8 +487,8 @@ namespace Project.Dialog
if (lv == null) return;
if (lv.Tag == null) return;
var msg = lv.Tag.ToString();
- Util.MsgI(msg);
-
+ Util.MsgI(msg);
+
}
}
}
diff --git a/Project/EETGW.csproj b/Project/EETGW.csproj
index eb935ce..c8fa1e1 100644
--- a/Project/EETGW.csproj
+++ b/Project/EETGW.csproj
@@ -129,6 +129,9 @@
..\packages\CsvHelper.30.0.1\lib\net45\CsvHelper.dll
+
+ ..\DLL\DatabaseConnectionString.exe
+
..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll
@@ -245,21 +248,6 @@
-
- True
- True
- AdoNetEFMain.Context.tt
-
-
- True
- True
- AdoNetEFMain.tt
-
-
- True
- True
- AdoNetEFMain.edmx
-
@@ -273,9 +261,6 @@
-
- ModelCommon.tt
-
True
True
@@ -349,29 +334,16 @@
True
dsMSSQL.xsd
+
+ True
+ True
+ dsProjects.xsd
+
True
True
DSQuery.xsd
-
- AdoNetEFMain.tt
-
-
- AdoNetEFMain.tt
-
-
- AdoNetEFMain.tt
-
-
- ModelProject.tt
-
-
- ModelProject.tt
-
-
- ModelProject.tt
-
Form
@@ -390,127 +362,22 @@
fSetting.cs
-
- AdoNetEFMain.tt
-
-
- ModelPurchase.tt
-
-
- AdoNetEFMain.tt
-
-
- True
- True
- ModelCommon.Context.tt
-
-
- True
- True
- ModelCommon.tt
-
-
- True
- True
- ModelCommon.edmx
-
-
- True
- True
- ModelJobreport.Context.tt
-
-
- True
- True
- ModelJobreport.tt
-
-
- True
- True
- ModelJobreport.edmx
-
-
- True
- True
- ModelProject.Context.tt
-
-
- True
- True
- ModelProject.tt
-
-
- True
- True
- ModelProject.edmx
-
-
- True
- True
- ModelPurchase.Context.tt
-
-
- True
- True
- ModelPurchase.tt
-
-
- True
- True
- ModelPurchase.edmx
-
-
- AdoNetEFMain.tt
-
-
- AdoNetEFMain.tt
-
-
- AdoNetEFMain.tt
-
-
- AdoNetEFMain.tt
-
-
- AdoNetEFMain.tt
-
-
- AdoNetEFMain.tt
-
Form
-
- AdoNetEFMain.tt
-
-
- AdoNetEFMain.tt
-
-
- AdoNetEFMain.tt
-
-
- AdoNetEFMain.tt
-
-
- ModelJobreport.tt
-
-
- ModelPurchase.tt
-
Form
@@ -640,13 +507,6 @@
Resources.resx
True
-
- EntityModelCodeGenerator
- AdoNetEFMain.Designer.cs
-
-
- AdoNetEFMain.edmx
-
DataSet1.xsd
@@ -681,6 +541,17 @@
dsMSSQL.xsd
+
+ dsProjects.xsd
+
+
+ Designer
+ MSDataSetGenerator
+ dsProjects.Designer.cs
+
+
+ dsProjects.xsd
+
DSQuery.xsd
@@ -695,34 +566,6 @@
PreserveNewest
-
- EntityModelCodeGenerator
- ModelPurchase.Designer.cs
-
-
- EntityModelCodeGenerator
- ModelCommon.Designer.cs
-
-
- ModelCommon.edmx
-
-
- EntityModelCodeGenerator
- ModelJobreport.Designer.cs
-
-
- ModelJobreport.edmx
-
-
- EntityModelCodeGenerator
- ModelProject.Designer.cs
-
-
- ModelProject.edmx
-
-
- ModelPurchase.edmx
-
@@ -742,61 +585,11 @@
-
- TextTemplatingFileGenerator
- AdoNetEFMain.edmx
- AdoNetEFMain.Context.cs
-
-
- TextTemplatingFileGenerator
- AdoNetEFMain.edmx
- AdoNetEFMain.cs
-
PreserveNewest
-
- TextTemplatingFileGenerator
- ModelCommon.edmx
- ModelCommon.Context.cs
-
-
- TextTemplatingFileGenerator
- ModelCommon.edmx
- ModelCommon.cs
-
-
- TextTemplatingFileGenerator
- ModelJobreport.edmx
- ModelJobreport.Context.cs
-
-
- TextTemplatingFileGenerator
- ModelJobreport.edmx
- ModelJobreport.cs
-
-
- TextTemplatingFileGenerator
- ModelProject.edmx
- ModelProject.Context.cs
-
-
- TextTemplatingFileGenerator
- ModelProject.edmx
- ModelProject.cs
-
-
- TextTemplatingFileGenerator
- ModelPurchase.edmx
- ModelPurchase.Context.cs
-
-
- TextTemplatingFileGenerator
- ModelPurchase.edmx
- ModelPurchase.cs
-
PreserveNewest
diff --git a/Project/EETGW_GroupUser.cs b/Project/EETGW_GroupUser.cs
deleted file mode 100644
index d7ad1db..0000000
--- a/Project/EETGW_GroupUser.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 이 코드는 템플릿에서 생성되었습니다.
-//
-// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
-// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
-//
-//------------------------------------------------------------------------------
-
-namespace Project
-{
- using System;
- using System.Collections.Generic;
-
- public partial class EETGW_GroupUser
- {
- public int idx { get; set; }
- public string gcode { get; set; }
- public string uid { get; set; }
- public Nullable level { get; set; }
- public string Process { get; set; }
- public string state { get; set; }
- public Nullable useJobReport { get; set; }
- public Nullable useUserState { get; set; }
- public string wuid { get; set; }
- public System.DateTime wdate { get; set; }
- public Nullable exceptHoly { get; set; }
- }
-}
diff --git a/Project/EETGW_JobReport_AutoInput.cs b/Project/EETGW_JobReport_AutoInput.cs
deleted file mode 100644
index 4d173f8..0000000
--- a/Project/EETGW_JobReport_AutoInput.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 이 코드는 템플릿에서 생성되었습니다.
-//
-// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
-// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
-//
-//------------------------------------------------------------------------------
-
-namespace Project
-{
- using System;
- using System.Collections.Generic;
-
- public partial class EETGW_JobReport_AutoInput
- {
- public int idx { get; set; }
- public string gcode { get; set; }
- public string pdate { get; set; }
- public string edate { get; set; }
- public Nullable pidx { get; set; }
- public string projectName { get; set; }
- public string uid { get; set; }
- public string requestpart { get; set; }
- public string package { get; set; }
- public string status { get; set; }
- public string type { get; set; }
- public string process { get; set; }
- public string description { get; set; }
- public string remark { get; set; }
- public Nullable hrs { get; set; }
- public Nullable ot { get; set; }
- public Nullable import { get; set; }
- public string wuid { get; set; }
- public System.DateTime wdate { get; set; }
- public string description2 { get; set; }
- public string tag { get; set; }
- public string autoinput { get; set; }
- public Nullable enable { get; set; }
- public string jobgrp { get; set; }
- }
-}
diff --git a/Project/EETGW_LoginInfo.cs b/Project/EETGW_LoginInfo.cs
deleted file mode 100644
index a06c76b..0000000
--- a/Project/EETGW_LoginInfo.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 이 코드는 템플릿에서 생성되었습니다.
-//
-// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
-// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
-//
-//------------------------------------------------------------------------------
-
-namespace Project
-{
- using System;
- using System.Collections.Generic;
-
- public partial class EETGW_LoginInfo
- {
- public int idx { get; set; }
- public string uid { get; set; }
- public Nullable login { get; set; }
- public string ip { get; set; }
- public string hostname { get; set; }
- public string wuid { get; set; }
- public Nullable wdate { get; set; }
- }
-}
diff --git a/Project/EETGW_ProjectToDo.cs b/Project/EETGW_ProjectToDo.cs
deleted file mode 100644
index 94daeca..0000000
--- a/Project/EETGW_ProjectToDo.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 이 코드는 템플릿에서 생성되었습니다.
-//
-// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
-// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
-//
-//------------------------------------------------------------------------------
-
-namespace Project
-{
- using System;
- using System.Collections.Generic;
-
- public partial class EETGW_ProjectToDo
- {
- public int idx { get; set; }
- public int pidx { get; set; }
- public Nullable pseq { get; set; }
- public Nullable sw { get; set; }
- public Nullable ww { get; set; }
- public string sort { get; set; }
- public string cate { get; set; }
- public string title { get; set; }
- public string pdate { get; set; }
- public string edate { get; set; }
- public Nullable process { get; set; }
- public string remark { get; set; }
- public string remark2 { get; set; }
- public string wuid { get; set; }
- public System.DateTime wdate { get; set; }
- }
-}
diff --git a/Project/EETGW_ProjecthistoryD.cs b/Project/EETGW_ProjecthistoryD.cs
deleted file mode 100644
index de228f9..0000000
--- a/Project/EETGW_ProjecthistoryD.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 이 코드는 템플릿에서 생성되었습니다.
-//
-// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
-// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
-//
-//------------------------------------------------------------------------------
-
-namespace Project
-{
- using System;
- using System.Collections.Generic;
-
- public partial class EETGW_ProjecthistoryD
- {
- public int idx { get; set; }
- public int pidx { get; set; }
- public string pdate { get; set; }
- public string div { get; set; }
- public string remark { get; set; }
- public string remark2 { get; set; }
- public Nullable mailsend { get; set; }
- public string wuid { get; set; }
- public System.DateTime wdate { get; set; }
- }
-}
diff --git a/Project/EETGW_ProjectsSchedule.cs b/Project/EETGW_ProjectsSchedule.cs
deleted file mode 100644
index 25b150a..0000000
--- a/Project/EETGW_ProjectsSchedule.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 이 코드는 템플릿에서 생성되었습니다.
-//
-// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
-// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
-//
-//------------------------------------------------------------------------------
-
-namespace Project
-{
- using System;
- using System.Collections.Generic;
-
- public partial class EETGW_ProjectsSchedule
- {
- public int idx { get; set; }
- public string gcode { get; set; }
- public Nullable project { get; set; }
- public Nullable no { get; set; }
- public Nullable seq { get; set; }
- public string title { get; set; }
- public Nullable sw { get; set; }
- public Nullable ew { get; set; }
- public Nullable swa { get; set; }
- public Nullable ewa { get; set; }
- public string uid { get; set; }
- public string memo { get; set; }
- public Nullable appoval { get; set; }
- public Nullable progress { get; set; }
- public string wuid { get; set; }
- public System.DateTime wdate { get; set; }
- }
-}
diff --git a/Project/HolidayLIst.cs b/Project/HolidayLIst.cs
deleted file mode 100644
index 503e6c6..0000000
--- a/Project/HolidayLIst.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 이 코드는 템플릿에서 생성되었습니다.
-//
-// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
-// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
-//
-//------------------------------------------------------------------------------
-
-namespace Project
-{
- using System;
- using System.Collections.Generic;
-
- public partial class HolidayLIst
- {
- public int idx { get; set; }
- public string pdate { get; set; }
- public Nullable free { get; set; }
- public string memo { get; set; }
- public string wuid { get; set; }
- public System.DateTime wdate { get; set; }
- }
-}
diff --git a/Project/Items.cs b/Project/Items.cs
deleted file mode 100644
index 8be7b4c..0000000
--- a/Project/Items.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 이 코드는 템플릿에서 생성되었습니다.
-//
-// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
-// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
-//
-//------------------------------------------------------------------------------
-
-namespace Project
-{
- using System;
- using System.Collections.Generic;
-
- public partial class Items
- {
- public int idx { get; set; }
- public Nullable disable { get; set; }
- public string gcode { get; set; }
- public string cate { get; set; }
- public string name { get; set; }
- public string sid { get; set; }
- public string model { get; set; }
- public string manu { get; set; }
- public Nullable scale { get; set; }
- public string unit { get; set; }
- public string supply { get; set; }
- public Nullable supplyidx { get; set; }
- public Nullable price { get; set; }
- public string memo { get; set; }
- public byte[] image { get; set; }
- public Nullable bparam1 { get; set; }
- public Nullable iparam1 { get; set; }
- public string import { get; set; }
- public string wuid { get; set; }
- public System.DateTime wdate { get; set; }
- public Nullable bEstimate { get; set; }
- public Nullable bSAP { get; set; }
- public Nullable priceD { get; set; }
- }
-}
diff --git a/Project/JobReport.cs b/Project/JobReport.cs
deleted file mode 100644
index 7a0ddb8..0000000
--- a/Project/JobReport.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 이 코드는 템플릿에서 생성되었습니다.
-//
-// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
-// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
-//
-//------------------------------------------------------------------------------
-
-namespace Project
-{
- using System;
- using System.Collections.Generic;
-
- public partial class JobReport
- {
- public int idx { get; set; }
- public string gcode { get; set; }
- public string pdate { get; set; }
- public Nullable pidx { get; set; }
- public string projectName { get; set; }
- public string uid { get; set; }
- public string requestpart { get; set; }
- public string package { get; set; }
- public string status { get; set; }
- public string type { get; set; }
- public string process { get; set; }
- public string description { get; set; }
- public string remark { get; set; }
- public Nullable hrs { get; set; }
- public Nullable ot { get; set; }
- public Nullable import { get; set; }
- public string wuid { get; set; }
- public System.DateTime wdate { get; set; }
- public string description2 { get; set; }
- public string tag { get; set; }
- public Nullable autoinput { get; set; }
- public Nullable otStart { get; set; }
- public Nullable otEnd { get; set; }
- public string kisullv { get; set; }
- public string kisuldiv { get; set; }
- public Nullable kisulamt { get; set; }
- public Nullable ot2 { get; set; }
- public string otReason { get; set; }
- public string otwuid { get; set; }
- public Nullable ottime { get; set; }
- public string jobgrp { get; set; }
- }
-}
diff --git a/Project/ModelCommon.Context.cs b/Project/ModelCommon.Context.cs
deleted file mode 100644
index a6c5b27..0000000
--- a/Project/ModelCommon.Context.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 이 코드는 템플릿에서 생성되었습니다.
-//
-// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
-// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
-//
-//------------------------------------------------------------------------------
-
-namespace Project
-{
- using System;
- using System.Data.Entity;
- using System.Data.Entity.Infrastructure;
-
- public partial class EEEntitiesCommon : DbContext
- {
- public EEEntitiesCommon()
- : base("name=EEEntitiesCommon")
- {
- }
-
- protected override void OnModelCreating(DbModelBuilder modelBuilder)
- {
- throw new UnintentionalCodeFirstException();
- }
-
- public virtual DbSet Customs { get; set; }
- }
-}
diff --git a/Project/ModelCommon.Context.tt b/Project/ModelCommon.Context.tt
deleted file mode 100644
index fc64179..0000000
--- a/Project/ModelCommon.Context.tt
+++ /dev/null
@@ -1,636 +0,0 @@
-<#@ template language="C#" debug="false" hostspecific="true"#>
-<#@ include file="EF6.Utility.CS.ttinclude"#><#@
- output extension=".cs"#><#
-
-const string inputFile = @"ModelCommon.edmx";
-var textTransform = DynamicTextTransformation.Create(this);
-var code = new CodeGenerationTools(this);
-var ef = new MetadataTools(this);
-var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
-var loader = new EdmMetadataLoader(textTransform.Host, textTransform.Errors);
-var itemCollection = loader.CreateEdmItemCollection(inputFile);
-var modelNamespace = loader.GetModelNamespace(inputFile);
-var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
-
-var container = itemCollection.OfType().FirstOrDefault();
-if (container == null)
-{
- return string.Empty;
-}
-#>
-//------------------------------------------------------------------------------
-//
-// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
-//
-// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
-// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
-//
-//------------------------------------------------------------------------------
-
-<#
-
-var codeNamespace = code.VsNamespaceSuggestion();
-if (!String.IsNullOrEmpty(codeNamespace))
-{
-#>
-namespace <#=code.EscapeNamespace(codeNamespace)#>
-{
-<#
- PushIndent(" ");
-}
-
-#>
-using System;
-using System.Data.Entity;
-using System.Data.Entity.Infrastructure;
-<#
-if (container.FunctionImports.Any())
-{
-#>
-using System.Data.Entity.Core.Objects;
-using System.Linq;
-<#
-}
-#>
-
-<#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : DbContext
-{
- public <#=code.Escape(container)#>()
- : base("name=<#=container.Name#>")
- {
-<#
-if (!loader.IsLazyLoadingEnabled(container))
-{
-#>
- this.Configuration.LazyLoadingEnabled = false;
-<#
-}
-
-foreach (var entitySet in container.BaseEntitySets.OfType())
-{
- // Note: the DbSet members are defined below such that the getter and
- // setter always have the same accessibility as the DbSet definition
- if (Accessibility.ForReadOnlyProperty(entitySet) != "public")
- {
-#>
- <#=codeStringGenerator.DbSetInitializer(entitySet)#>
-<#
- }
-}
-#>
- }
-
- protected override void OnModelCreating(DbModelBuilder modelBuilder)
- {
- throw new UnintentionalCodeFirstException();
- }
-
-<#
- foreach (var entitySet in container.BaseEntitySets.OfType())
- {
-#>
- <#=codeStringGenerator.DbSet(entitySet)#>
-<#
- }
-
- foreach (var edmFunction in container.FunctionImports)
- {
- WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: false);
- }
-#>
-}
-<#
-
-if (!String.IsNullOrEmpty(codeNamespace))
-{
- PopIndent();
-#>
-}
-<#
-}
-#>
-<#+
-
-private void WriteFunctionImport(TypeMapper typeMapper, CodeStringGenerator codeStringGenerator, EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
-{
- if (typeMapper.IsComposable(edmFunction))
- {
-#>
-
- [DbFunction("<#=edmFunction.NamespaceName#>", "<#=edmFunction.Name#>")]
- <#=codeStringGenerator.ComposableFunctionMethod(edmFunction, modelNamespace)#>
- {
-<#+
- codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
-#>
- <#=codeStringGenerator.ComposableCreateQuery(edmFunction, modelNamespace)#>
- }
-<#+
- }
- else
- {
-#>
-
- <#=codeStringGenerator.FunctionMethod(edmFunction, modelNamespace, includeMergeOption)#>
- {
-<#+
- codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
-#>
- <#=codeStringGenerator.ExecuteFunction(edmFunction, modelNamespace, includeMergeOption)#>
- }
-<#+
- if (typeMapper.GenerateMergeOptionFunction(edmFunction, includeMergeOption))
- {
- WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: true);
- }
- }
-}
-
-public void WriteFunctionParameter(string name, string isNotNull, string notNullInit, string nullInit)
-{
-#>
- var <#=name#> = <#=isNotNull#> ?
- <#=notNullInit#> :
- <#=nullInit#>;
-
-<#+
-}
-
-public const string TemplateId = "CSharp_DbContext_Context_EF6";
-
-public class CodeStringGenerator
-{
- private readonly CodeGenerationTools _code;
- private readonly TypeMapper _typeMapper;
- private readonly MetadataTools _ef;
-
- public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
- {
- ArgumentNotNull(code, "code");
- ArgumentNotNull(typeMapper, "typeMapper");
- ArgumentNotNull(ef, "ef");
-
- _code = code;
- _typeMapper = typeMapper;
- _ef = ef;
- }
-
- public string Property(EdmProperty edmProperty)
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} {1} {2} {{ {3}get; {4}set; }}",
- Accessibility.ForProperty(edmProperty),
- _typeMapper.GetTypeName(edmProperty.TypeUsage),
- _code.Escape(edmProperty),
- _code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
- _code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
- }
-
- public string NavigationProperty(NavigationProperty navProp)
- {
- var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} {1} {2} {{ {3}get; {4}set; }}",
- AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
- navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
- _code.Escape(navProp),
- _code.SpaceAfter(Accessibility.ForGetter(navProp)),
- _code.SpaceAfter(Accessibility.ForSetter(navProp)));
- }
-
- public string AccessibilityAndVirtual(string accessibility)
- {
- return accessibility + (accessibility != "private" ? " virtual" : "");
- }
-
- public string EntityClassOpening(EntityType entity)
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} {1}partial class {2}{3}",
- Accessibility.ForType(entity),
- _code.SpaceAfter(_code.AbstractOption(entity)),
- _code.Escape(entity),
- _code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
- }
-
- public string EnumOpening(SimpleType enumType)
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} enum {1} : {2}",
- Accessibility.ForType(enumType),
- _code.Escape(enumType),
- _code.Escape(_typeMapper.UnderlyingClrType(enumType)));
- }
-
- public void WriteFunctionParameters(EdmFunction edmFunction, Action writeParameter)
- {
- var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
- foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
- {
- var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
- var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
- var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
- writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
- }
- }
-
- public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
- {
- var parameters = _typeMapper.GetParameters(edmFunction);
-
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} IQueryable<{1}> {2}({3})",
- AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
- _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
- _code.Escape(edmFunction),
- string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
- }
-
- public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
- {
- var parameters = _typeMapper.GetParameters(edmFunction);
-
- return string.Format(
- CultureInfo.InvariantCulture,
- "return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
- _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
- edmFunction.NamespaceName,
- edmFunction.Name,
- string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
- _code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
- }
-
- public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
- {
- var parameters = _typeMapper.GetParameters(edmFunction);
- var returnType = _typeMapper.GetReturnType(edmFunction);
-
- var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
- if (includeMergeOption)
- {
- paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
- }
-
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} {1} {2}({3})",
- AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
- returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
- _code.Escape(edmFunction),
- paramList);
- }
-
- public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
- {
- var parameters = _typeMapper.GetParameters(edmFunction);
- var returnType = _typeMapper.GetReturnType(edmFunction);
-
- var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
- if (includeMergeOption)
- {
- callParams = ", mergeOption" + callParams;
- }
-
- return string.Format(
- CultureInfo.InvariantCulture,
- "return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
- returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
- edmFunction.Name,
- callParams);
- }
-
- public string DbSet(EntitySet entitySet)
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} virtual DbSet<{1}> {2} {{ get; set; }}",
- Accessibility.ForReadOnlyProperty(entitySet),
- _typeMapper.GetTypeName(entitySet.ElementType),
- _code.Escape(entitySet));
- }
-
- public string DbSetInitializer(EntitySet entitySet)
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} = Set<{1}>();",
- _code.Escape(entitySet),
- _typeMapper.GetTypeName(entitySet.ElementType));
- }
-
- public string UsingDirectives(bool inHeader, bool includeCollections = true)
- {
- return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
- ? string.Format(
- CultureInfo.InvariantCulture,
- "{0}using System;{1}" +
- "{2}",
- inHeader ? Environment.NewLine : "",
- includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
- inHeader ? "" : Environment.NewLine)
- : "";
- }
-}
-
-public class TypeMapper
-{
- private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
-
- private readonly System.Collections.IList _errors;
- private readonly CodeGenerationTools _code;
- private readonly MetadataTools _ef;
-
- public static string FixNamespaces(string typeName)
- {
- return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
- }
-
- public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
- {
- ArgumentNotNull(code, "code");
- ArgumentNotNull(ef, "ef");
- ArgumentNotNull(errors, "errors");
-
- _code = code;
- _ef = ef;
- _errors = errors;
- }
-
- public string GetTypeName(TypeUsage typeUsage)
- {
- return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
- }
-
- public string GetTypeName(EdmType edmType)
- {
- return GetTypeName(edmType, isNullable: null, modelNamespace: null);
- }
-
- public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
- {
- return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
- }
-
- public string GetTypeName(EdmType edmType, string modelNamespace)
- {
- return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
- }
-
- public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
- {
- if (edmType == null)
- {
- return null;
- }
-
- var collectionType = edmType as CollectionType;
- if (collectionType != null)
- {
- return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
- }
-
- var typeName = _code.Escape(edmType.MetadataProperties
- .Where(p => p.Name == ExternalTypeNameAttributeName)
- .Select(p => (string)p.Value)
- .FirstOrDefault())
- ?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
- _code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
- _code.Escape(edmType));
-
- if (edmType is StructuralType)
- {
- return typeName;
- }
-
- if (edmType is SimpleType)
- {
- var clrType = UnderlyingClrType(edmType);
- if (!IsEnumType(edmType))
- {
- typeName = _code.Escape(clrType);
- }
-
- typeName = FixNamespaces(typeName);
-
- return clrType.IsValueType && isNullable == true ?
- String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
- typeName;
- }
-
- throw new ArgumentException("edmType");
- }
-
- public Type UnderlyingClrType(EdmType edmType)
- {
- ArgumentNotNull(edmType, "edmType");
-
- var primitiveType = edmType as PrimitiveType;
- if (primitiveType != null)
- {
- return primitiveType.ClrEquivalentType;
- }
-
- if (IsEnumType(edmType))
- {
- return GetEnumUnderlyingType(edmType).ClrEquivalentType;
- }
-
- return typeof(object);
- }
-
- public object GetEnumMemberValue(MetadataItem enumMember)
- {
- ArgumentNotNull(enumMember, "enumMember");
-
- var valueProperty = enumMember.GetType().GetProperty("Value");
- return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
- }
-
- public string GetEnumMemberName(MetadataItem enumMember)
- {
- ArgumentNotNull(enumMember, "enumMember");
-
- var nameProperty = enumMember.GetType().GetProperty("Name");
- return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
- }
-
- public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
- {
- ArgumentNotNull(enumType, "enumType");
-
- var membersProperty = enumType.GetType().GetProperty("Members");
- return membersProperty != null
- ? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
- : Enumerable.Empty();
- }
-
- public bool EnumIsFlags(EdmType enumType)
- {
- ArgumentNotNull(enumType, "enumType");
-
- var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
- return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
- }
-
- public bool IsEnumType(GlobalItem edmType)
- {
- ArgumentNotNull(edmType, "edmType");
-
- return edmType.GetType().Name == "EnumType";
- }
-
- public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
- {
- ArgumentNotNull(enumType, "enumType");
-
- return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
- }
-
- public string CreateLiteral(object value)
- {
- if (value == null || value.GetType() != typeof(TimeSpan))
- {
- return _code.CreateLiteral(value);
- }
-
- return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
- }
-
- public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable types, string sourceFile)
- {
- ArgumentNotNull(types, "types");
- ArgumentNotNull(sourceFile, "sourceFile");
-
- var hash = new HashSet(StringComparer.InvariantCultureIgnoreCase);
- if (types.Any(item => !hash.Add(item)))
- {
- _errors.Add(
- new CompilerError(sourceFile, -1, -1, "6023",
- String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
- return false;
- }
- return true;
- }
-
- public IEnumerable GetEnumItemsToGenerate(IEnumerable itemCollection)
- {
- return GetItemsToGenerate(itemCollection)
- .Where(e => IsEnumType(e));
- }
-
- public IEnumerable GetItemsToGenerate(IEnumerable itemCollection) where T: EdmType
- {
- return itemCollection
- .OfType()
- .Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
- .OrderBy(i => i.Name);
- }
-
- public IEnumerable GetAllGlobalItems(IEnumerable itemCollection)
- {
- return itemCollection
- .Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
- .Select(g => GetGlobalItemName(g));
- }
-
- public string GetGlobalItemName(GlobalItem item)
- {
- if (item is EdmType)
- {
- return ((EdmType)item).Name;
- }
- else
- {
- return ((EntityContainer)item).Name;
- }
- }
-
- public IEnumerable GetSimpleProperties(EntityType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
- }
-
- public IEnumerable GetSimpleProperties(ComplexType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
- }
-
- public IEnumerable GetComplexProperties(EntityType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
- }
-
- public IEnumerable GetComplexProperties(ComplexType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
- }
-
- public IEnumerable GetPropertiesWithDefaultValues(EntityType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
- }
-
- public IEnumerable GetPropertiesWithDefaultValues(ComplexType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
- }
-
- public IEnumerable GetNavigationProperties(EntityType type)
- {
- return type.NavigationProperties.Where(np => np.DeclaringType == type);
- }
-
- public IEnumerable GetCollectionNavigationProperties(EntityType type)
- {
- return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
- }
-
- public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
- {
- ArgumentNotNull(edmFunction, "edmFunction");
-
- var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
- return returnParamsProperty == null
- ? edmFunction.ReturnParameter
- : ((IEnumerable)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
- }
-
- public bool IsComposable(EdmFunction edmFunction)
- {
- ArgumentNotNull(edmFunction, "edmFunction");
-
- var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
- return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
- }
-
- public IEnumerable GetParameters(EdmFunction edmFunction)
- {
- return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
- }
-
- public TypeUsage GetReturnType(EdmFunction edmFunction)
- {
- var returnParam = GetReturnParameter(edmFunction);
- return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
- }
-
- public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
- {
- var returnType = GetReturnType(edmFunction);
- return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
- }
-}
-
-public static void ArgumentNotNull(T arg, string name) where T : class
-{
- if (arg == null)
- {
- throw new ArgumentNullException(name);
- }
-}
-#>
\ No newline at end of file
diff --git a/Project/ModelCommon.Designer.cs b/Project/ModelCommon.Designer.cs
deleted file mode 100644
index 2222832..0000000
--- a/Project/ModelCommon.Designer.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-// 모델 'D:\Source\##### 완료아이템\(014) GroupWare\Source\Project\ModelCommon.edmx'에 대해 T4 코드 생성이 사용됩니다.
-// 레거시 코드 생성을 사용하려면 '코드 생성 전략' 디자이너 속성의 값을
-// 'Legacy ObjectContext'로 변경하십시오. 이 속성은 모델이 디자이너에서 열릴 때
-// 속성 창에서 사용할 수 있습니다.
-
-// 컨텍스트 및 엔터티 클래스가 생성되지 않은 경우 빈 모델을 만들었기 때문일 수도 있지만
-// 사용할 Entity Framework 버전을 선택하지 않았기 때문일 수도 있습니다. 모델에 맞는 컨텍스트 클래스 및
-// 엔터티 클래스를 생성하려면 디자이너에서 모델을 열고 디자이너 화면에서 마우스 오른쪽 단추를 클릭한
-// 다음 '데이터베이스에서 모델 업데이트...', '모델에서 데이터베이스 생성...' 또는 '코드 생성 항목 추가...'를
-// 선택하십시오.
\ No newline at end of file
diff --git a/Project/ModelCommon.cs b/Project/ModelCommon.cs
deleted file mode 100644
index 7a9ab12..0000000
--- a/Project/ModelCommon.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 이 코드는 템플릿에서 생성되었습니다.
-//
-// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
-// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
-//
-//------------------------------------------------------------------------------
-
diff --git a/Project/ModelCommon.edmx b/Project/ModelCommon.edmx
deleted file mode 100644
index 2628391..0000000
--- a/Project/ModelCommon.edmx
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Project/ModelCommon.edmx.diagram b/Project/ModelCommon.edmx.diagram
deleted file mode 100644
index d110e9a..0000000
--- a/Project/ModelCommon.edmx.diagram
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Project/ModelCommon.tt b/Project/ModelCommon.tt
deleted file mode 100644
index a773215..0000000
--- a/Project/ModelCommon.tt
+++ /dev/null
@@ -1,733 +0,0 @@
-<#@ template language="C#" debug="false" hostspecific="true"#>
-<#@ include file="EF6.Utility.CS.ttinclude"#><#@
- output extension=".cs"#><#
-
-const string inputFile = @"ModelCommon.edmx";
-var textTransform = DynamicTextTransformation.Create(this);
-var code = new CodeGenerationTools(this);
-var ef = new MetadataTools(this);
-var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
-var fileManager = EntityFrameworkTemplateFileManager.Create(this);
-var itemCollection = new EdmMetadataLoader(textTransform.Host, textTransform.Errors).CreateEdmItemCollection(inputFile);
-var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
-
-if (!typeMapper.VerifyCaseInsensitiveTypeUniqueness(typeMapper.GetAllGlobalItems(itemCollection), inputFile))
-{
- return string.Empty;
-}
-
-WriteHeader(codeStringGenerator, fileManager);
-
-foreach (var entity in typeMapper.GetItemsToGenerate(itemCollection))
-{
- fileManager.StartNewFile(entity.Name + ".cs");
- BeginNamespace(code);
-#>
-<#=codeStringGenerator.UsingDirectives(inHeader: false)#>
-<#=codeStringGenerator.EntityClassOpening(entity)#>
-{
-<#
- var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(entity);
- var collectionNavigationProperties = typeMapper.GetCollectionNavigationProperties(entity);
- var complexProperties = typeMapper.GetComplexProperties(entity);
-
- if (propertiesWithDefaultValues.Any() || collectionNavigationProperties.Any() || complexProperties.Any())
- {
-#>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
- public <#=code.Escape(entity)#>()
- {
-<#
- foreach (var edmProperty in propertiesWithDefaultValues)
- {
-#>
- this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
-<#
- }
-
- foreach (var navigationProperty in collectionNavigationProperties)
- {
-#>
- this.<#=code.Escape(navigationProperty)#> = new HashSet<<#=typeMapper.GetTypeName(navigationProperty.ToEndMember.GetEntityType())#>>();
-<#
- }
-
- foreach (var complexProperty in complexProperties)
- {
-#>
- this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
-<#
- }
-#>
- }
-
-<#
- }
-
- var simpleProperties = typeMapper.GetSimpleProperties(entity);
- if (simpleProperties.Any())
- {
- foreach (var edmProperty in simpleProperties)
- {
-#>
- <#=codeStringGenerator.Property(edmProperty)#>
-<#
- }
- }
-
- if (complexProperties.Any())
- {
-#>
-
-<#
- foreach(var complexProperty in complexProperties)
- {
-#>
- <#=codeStringGenerator.Property(complexProperty)#>
-<#
- }
- }
-
- var navigationProperties = typeMapper.GetNavigationProperties(entity);
- if (navigationProperties.Any())
- {
-#>
-
-<#
- foreach (var navigationProperty in navigationProperties)
- {
- if (navigationProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
- {
-#>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
-<#
- }
-#>
- <#=codeStringGenerator.NavigationProperty(navigationProperty)#>
-<#
- }
- }
-#>
-}
-<#
- EndNamespace(code);
-}
-
-foreach (var complex in typeMapper.GetItemsToGenerate(itemCollection))
-{
- fileManager.StartNewFile(complex.Name + ".cs");
- BeginNamespace(code);
-#>
-<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
-<#=Accessibility.ForType(complex)#> partial class <#=code.Escape(complex)#>
-{
-<#
- var complexProperties = typeMapper.GetComplexProperties(complex);
- var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(complex);
-
- if (propertiesWithDefaultValues.Any() || complexProperties.Any())
- {
-#>
- public <#=code.Escape(complex)#>()
- {
-<#
- foreach (var edmProperty in propertiesWithDefaultValues)
- {
-#>
- this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
-<#
- }
-
- foreach (var complexProperty in complexProperties)
- {
-#>
- this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
-<#
- }
-#>
- }
-
-<#
- }
-
- var simpleProperties = typeMapper.GetSimpleProperties(complex);
- if (simpleProperties.Any())
- {
- foreach(var edmProperty in simpleProperties)
- {
-#>
- <#=codeStringGenerator.Property(edmProperty)#>
-<#
- }
- }
-
- if (complexProperties.Any())
- {
-#>
-
-<#
- foreach(var edmProperty in complexProperties)
- {
-#>
- <#=codeStringGenerator.Property(edmProperty)#>
-<#
- }
- }
-#>
-}
-<#
- EndNamespace(code);
-}
-
-foreach (var enumType in typeMapper.GetEnumItemsToGenerate(itemCollection))
-{
- fileManager.StartNewFile(enumType.Name + ".cs");
- BeginNamespace(code);
-#>
-<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
-<#
- if (typeMapper.EnumIsFlags(enumType))
- {
-#>
-[Flags]
-<#
- }
-#>
-<#=codeStringGenerator.EnumOpening(enumType)#>
-{
-<#
- var foundOne = false;
-
- foreach (MetadataItem member in typeMapper.GetEnumMembers(enumType))
- {
- foundOne = true;
-#>
- <#=code.Escape(typeMapper.GetEnumMemberName(member))#> = <#=typeMapper.GetEnumMemberValue(member)#>,
-<#
- }
-
- if (foundOne)
- {
- this.GenerationEnvironment.Remove(this.GenerationEnvironment.Length - 3, 1);
- }
-#>
-}
-<#
- EndNamespace(code);
-}
-
-fileManager.Process();
-
-#>
-<#+
-
-public void WriteHeader(CodeStringGenerator codeStringGenerator, EntityFrameworkTemplateFileManager fileManager)
-{
- fileManager.StartHeader();
-#>
-//------------------------------------------------------------------------------
-//
-// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
-//
-// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
-// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
-//
-//------------------------------------------------------------------------------
-<#=codeStringGenerator.UsingDirectives(inHeader: true)#>
-<#+
- fileManager.EndBlock();
-}
-
-public void BeginNamespace(CodeGenerationTools code)
-{
- var codeNamespace = code.VsNamespaceSuggestion();
- if (!String.IsNullOrEmpty(codeNamespace))
- {
-#>
-namespace <#=code.EscapeNamespace(codeNamespace)#>
-{
-<#+
- PushIndent(" ");
- }
-}
-
-public void EndNamespace(CodeGenerationTools code)
-{
- if (!String.IsNullOrEmpty(code.VsNamespaceSuggestion()))
- {
- PopIndent();
-#>
-}
-<#+
- }
-}
-
-public const string TemplateId = "CSharp_DbContext_Types_EF6";
-
-public class CodeStringGenerator
-{
- private readonly CodeGenerationTools _code;
- private readonly TypeMapper _typeMapper;
- private readonly MetadataTools _ef;
-
- public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
- {
- ArgumentNotNull(code, "code");
- ArgumentNotNull(typeMapper, "typeMapper");
- ArgumentNotNull(ef, "ef");
-
- _code = code;
- _typeMapper = typeMapper;
- _ef = ef;
- }
-
- public string Property(EdmProperty edmProperty)
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} {1} {2} {{ {3}get; {4}set; }}",
- Accessibility.ForProperty(edmProperty),
- _typeMapper.GetTypeName(edmProperty.TypeUsage),
- _code.Escape(edmProperty),
- _code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
- _code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
- }
-
- public string NavigationProperty(NavigationProperty navProp)
- {
- var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} {1} {2} {{ {3}get; {4}set; }}",
- AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
- navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
- _code.Escape(navProp),
- _code.SpaceAfter(Accessibility.ForGetter(navProp)),
- _code.SpaceAfter(Accessibility.ForSetter(navProp)));
- }
-
- public string AccessibilityAndVirtual(string accessibility)
- {
- return accessibility + (accessibility != "private" ? " virtual" : "");
- }
-
- public string EntityClassOpening(EntityType entity)
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} {1}partial class {2}{3}",
- Accessibility.ForType(entity),
- _code.SpaceAfter(_code.AbstractOption(entity)),
- _code.Escape(entity),
- _code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
- }
-
- public string EnumOpening(SimpleType enumType)
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} enum {1} : {2}",
- Accessibility.ForType(enumType),
- _code.Escape(enumType),
- _code.Escape(_typeMapper.UnderlyingClrType(enumType)));
- }
-
- public void WriteFunctionParameters(EdmFunction edmFunction, Action writeParameter)
- {
- var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
- foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
- {
- var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
- var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
- var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
- writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
- }
- }
-
- public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
- {
- var parameters = _typeMapper.GetParameters(edmFunction);
-
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} IQueryable<{1}> {2}({3})",
- AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
- _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
- _code.Escape(edmFunction),
- string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
- }
-
- public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
- {
- var parameters = _typeMapper.GetParameters(edmFunction);
-
- return string.Format(
- CultureInfo.InvariantCulture,
- "return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
- _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
- edmFunction.NamespaceName,
- edmFunction.Name,
- string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
- _code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
- }
-
- public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
- {
- var parameters = _typeMapper.GetParameters(edmFunction);
- var returnType = _typeMapper.GetReturnType(edmFunction);
-
- var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
- if (includeMergeOption)
- {
- paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
- }
-
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} {1} {2}({3})",
- AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
- returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
- _code.Escape(edmFunction),
- paramList);
- }
-
- public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
- {
- var parameters = _typeMapper.GetParameters(edmFunction);
- var returnType = _typeMapper.GetReturnType(edmFunction);
-
- var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
- if (includeMergeOption)
- {
- callParams = ", mergeOption" + callParams;
- }
-
- return string.Format(
- CultureInfo.InvariantCulture,
- "return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
- returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
- edmFunction.Name,
- callParams);
- }
-
- public string DbSet(EntitySet entitySet)
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} virtual DbSet<{1}> {2} {{ get; set; }}",
- Accessibility.ForReadOnlyProperty(entitySet),
- _typeMapper.GetTypeName(entitySet.ElementType),
- _code.Escape(entitySet));
- }
-
- public string UsingDirectives(bool inHeader, bool includeCollections = true)
- {
- return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
- ? string.Format(
- CultureInfo.InvariantCulture,
- "{0}using System;{1}" +
- "{2}",
- inHeader ? Environment.NewLine : "",
- includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
- inHeader ? "" : Environment.NewLine)
- : "";
- }
-}
-
-public class TypeMapper
-{
- private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
-
- private readonly System.Collections.IList _errors;
- private readonly CodeGenerationTools _code;
- private readonly MetadataTools _ef;
-
- public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
- {
- ArgumentNotNull(code, "code");
- ArgumentNotNull(ef, "ef");
- ArgumentNotNull(errors, "errors");
-
- _code = code;
- _ef = ef;
- _errors = errors;
- }
-
- public static string FixNamespaces(string typeName)
- {
- return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
- }
-
- public string GetTypeName(TypeUsage typeUsage)
- {
- return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
- }
-
- public string GetTypeName(EdmType edmType)
- {
- return GetTypeName(edmType, isNullable: null, modelNamespace: null);
- }
-
- public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
- {
- return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
- }
-
- public string GetTypeName(EdmType edmType, string modelNamespace)
- {
- return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
- }
-
- public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
- {
- if (edmType == null)
- {
- return null;
- }
-
- var collectionType = edmType as CollectionType;
- if (collectionType != null)
- {
- return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
- }
-
- var typeName = _code.Escape(edmType.MetadataProperties
- .Where(p => p.Name == ExternalTypeNameAttributeName)
- .Select(p => (string)p.Value)
- .FirstOrDefault())
- ?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
- _code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
- _code.Escape(edmType));
-
- if (edmType is StructuralType)
- {
- return typeName;
- }
-
- if (edmType is SimpleType)
- {
- var clrType = UnderlyingClrType(edmType);
- if (!IsEnumType(edmType))
- {
- typeName = _code.Escape(clrType);
- }
-
- typeName = FixNamespaces(typeName);
-
- return clrType.IsValueType && isNullable == true ?
- String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
- typeName;
- }
-
- throw new ArgumentException("edmType");
- }
-
- public Type UnderlyingClrType(EdmType edmType)
- {
- ArgumentNotNull(edmType, "edmType");
-
- var primitiveType = edmType as PrimitiveType;
- if (primitiveType != null)
- {
- return primitiveType.ClrEquivalentType;
- }
-
- if (IsEnumType(edmType))
- {
- return GetEnumUnderlyingType(edmType).ClrEquivalentType;
- }
-
- return typeof(object);
- }
-
- public object GetEnumMemberValue(MetadataItem enumMember)
- {
- ArgumentNotNull(enumMember, "enumMember");
-
- var valueProperty = enumMember.GetType().GetProperty("Value");
- return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
- }
-
- public string GetEnumMemberName(MetadataItem enumMember)
- {
- ArgumentNotNull(enumMember, "enumMember");
-
- var nameProperty = enumMember.GetType().GetProperty("Name");
- return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
- }
-
- public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
- {
- ArgumentNotNull(enumType, "enumType");
-
- var membersProperty = enumType.GetType().GetProperty("Members");
- return membersProperty != null
- ? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
- : Enumerable.Empty();
- }
-
- public bool EnumIsFlags(EdmType enumType)
- {
- ArgumentNotNull(enumType, "enumType");
-
- var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
- return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
- }
-
- public bool IsEnumType(GlobalItem edmType)
- {
- ArgumentNotNull(edmType, "edmType");
-
- return edmType.GetType().Name == "EnumType";
- }
-
- public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
- {
- ArgumentNotNull(enumType, "enumType");
-
- return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
- }
-
- public string CreateLiteral(object value)
- {
- if (value == null || value.GetType() != typeof(TimeSpan))
- {
- return _code.CreateLiteral(value);
- }
-
- return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
- }
-
- public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable types, string sourceFile)
- {
- ArgumentNotNull(types, "types");
- ArgumentNotNull(sourceFile, "sourceFile");
-
- var hash = new HashSet(StringComparer.InvariantCultureIgnoreCase);
- if (types.Any(item => !hash.Add(item)))
- {
- _errors.Add(
- new CompilerError(sourceFile, -1, -1, "6023",
- String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
- return false;
- }
- return true;
- }
-
- public IEnumerable GetEnumItemsToGenerate(IEnumerable itemCollection)
- {
- return GetItemsToGenerate(itemCollection)
- .Where(e => IsEnumType(e));
- }
-
- public IEnumerable GetItemsToGenerate(IEnumerable itemCollection) where T: EdmType
- {
- return itemCollection
- .OfType()
- .Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
- .OrderBy(i => i.Name);
- }
-
- public IEnumerable GetAllGlobalItems(IEnumerable itemCollection)
- {
- return itemCollection
- .Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
- .Select(g => GetGlobalItemName(g));
- }
-
- public string GetGlobalItemName(GlobalItem item)
- {
- if (item is EdmType)
- {
- return ((EdmType)item).Name;
- }
- else
- {
- return ((EntityContainer)item).Name;
- }
- }
-
- public IEnumerable GetSimpleProperties(EntityType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
- }
-
- public IEnumerable GetSimpleProperties(ComplexType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
- }
-
- public IEnumerable GetComplexProperties(EntityType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
- }
-
- public IEnumerable GetComplexProperties(ComplexType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
- }
-
- public IEnumerable GetPropertiesWithDefaultValues(EntityType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
- }
-
- public IEnumerable GetPropertiesWithDefaultValues(ComplexType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
- }
-
- public IEnumerable GetNavigationProperties(EntityType type)
- {
- return type.NavigationProperties.Where(np => np.DeclaringType == type);
- }
-
- public IEnumerable GetCollectionNavigationProperties(EntityType type)
- {
- return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
- }
-
- public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
- {
- ArgumentNotNull(edmFunction, "edmFunction");
-
- var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
- return returnParamsProperty == null
- ? edmFunction.ReturnParameter
- : ((IEnumerable)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
- }
-
- public bool IsComposable(EdmFunction edmFunction)
- {
- ArgumentNotNull(edmFunction, "edmFunction");
-
- var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
- return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
- }
-
- public IEnumerable GetParameters(EdmFunction edmFunction)
- {
- return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
- }
-
- public TypeUsage GetReturnType(EdmFunction edmFunction)
- {
- var returnParam = GetReturnParameter(edmFunction);
- return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
- }
-
- public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
- {
- var returnType = GetReturnType(edmFunction);
- return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
- }
-}
-
-public static void ArgumentNotNull(T arg, string name) where T : class
-{
- if (arg == null)
- {
- throw new ArgumentNullException(name);
- }
-}
-#>
\ No newline at end of file
diff --git a/Project/ModelJobreport.Context.cs b/Project/ModelJobreport.Context.cs
deleted file mode 100644
index 30812b8..0000000
--- a/Project/ModelJobreport.Context.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 이 코드는 템플릿에서 생성되었습니다.
-//
-// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
-// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
-//
-//------------------------------------------------------------------------------
-
-namespace Project
-{
- using System;
- using System.Data.Entity;
- using System.Data.Entity.Infrastructure;
-
- public partial class EEEntitiesJobreport : DbContext
- {
- public EEEntitiesJobreport()
- : base("name=EEEntitiesJobreport")
- {
- }
-
- protected override void OnModelCreating(DbModelBuilder modelBuilder)
- {
- throw new UnintentionalCodeFirstException();
- }
-
- public virtual DbSet JobReport { get; set; }
- public virtual DbSet vJobReportForUser { get; set; }
- }
-}
diff --git a/Project/ModelJobreport.Context.tt b/Project/ModelJobreport.Context.tt
deleted file mode 100644
index da9e66d..0000000
--- a/Project/ModelJobreport.Context.tt
+++ /dev/null
@@ -1,636 +0,0 @@
-<#@ template language="C#" debug="false" hostspecific="true"#>
-<#@ include file="EF6.Utility.CS.ttinclude"#><#@
- output extension=".cs"#><#
-
-const string inputFile = @"ModelJobreport.edmx";
-var textTransform = DynamicTextTransformation.Create(this);
-var code = new CodeGenerationTools(this);
-var ef = new MetadataTools(this);
-var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
-var loader = new EdmMetadataLoader(textTransform.Host, textTransform.Errors);
-var itemCollection = loader.CreateEdmItemCollection(inputFile);
-var modelNamespace = loader.GetModelNamespace(inputFile);
-var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
-
-var container = itemCollection.OfType().FirstOrDefault();
-if (container == null)
-{
- return string.Empty;
-}
-#>
-//------------------------------------------------------------------------------
-//
-// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
-//
-// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
-// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
-//
-//------------------------------------------------------------------------------
-
-<#
-
-var codeNamespace = code.VsNamespaceSuggestion();
-if (!String.IsNullOrEmpty(codeNamespace))
-{
-#>
-namespace <#=code.EscapeNamespace(codeNamespace)#>
-{
-<#
- PushIndent(" ");
-}
-
-#>
-using System;
-using System.Data.Entity;
-using System.Data.Entity.Infrastructure;
-<#
-if (container.FunctionImports.Any())
-{
-#>
-using System.Data.Entity.Core.Objects;
-using System.Linq;
-<#
-}
-#>
-
-<#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : DbContext
-{
- public <#=code.Escape(container)#>()
- : base("name=<#=container.Name#>")
- {
-<#
-if (!loader.IsLazyLoadingEnabled(container))
-{
-#>
- this.Configuration.LazyLoadingEnabled = false;
-<#
-}
-
-foreach (var entitySet in container.BaseEntitySets.OfType())
-{
- // Note: the DbSet members are defined below such that the getter and
- // setter always have the same accessibility as the DbSet definition
- if (Accessibility.ForReadOnlyProperty(entitySet) != "public")
- {
-#>
- <#=codeStringGenerator.DbSetInitializer(entitySet)#>
-<#
- }
-}
-#>
- }
-
- protected override void OnModelCreating(DbModelBuilder modelBuilder)
- {
- throw new UnintentionalCodeFirstException();
- }
-
-<#
- foreach (var entitySet in container.BaseEntitySets.OfType())
- {
-#>
- <#=codeStringGenerator.DbSet(entitySet)#>
-<#
- }
-
- foreach (var edmFunction in container.FunctionImports)
- {
- WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: false);
- }
-#>
-}
-<#
-
-if (!String.IsNullOrEmpty(codeNamespace))
-{
- PopIndent();
-#>
-}
-<#
-}
-#>
-<#+
-
-private void WriteFunctionImport(TypeMapper typeMapper, CodeStringGenerator codeStringGenerator, EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
-{
- if (typeMapper.IsComposable(edmFunction))
- {
-#>
-
- [DbFunction("<#=edmFunction.NamespaceName#>", "<#=edmFunction.Name#>")]
- <#=codeStringGenerator.ComposableFunctionMethod(edmFunction, modelNamespace)#>
- {
-<#+
- codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
-#>
- <#=codeStringGenerator.ComposableCreateQuery(edmFunction, modelNamespace)#>
- }
-<#+
- }
- else
- {
-#>
-
- <#=codeStringGenerator.FunctionMethod(edmFunction, modelNamespace, includeMergeOption)#>
- {
-<#+
- codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
-#>
- <#=codeStringGenerator.ExecuteFunction(edmFunction, modelNamespace, includeMergeOption)#>
- }
-<#+
- if (typeMapper.GenerateMergeOptionFunction(edmFunction, includeMergeOption))
- {
- WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: true);
- }
- }
-}
-
-public void WriteFunctionParameter(string name, string isNotNull, string notNullInit, string nullInit)
-{
-#>
- var <#=name#> = <#=isNotNull#> ?
- <#=notNullInit#> :
- <#=nullInit#>;
-
-<#+
-}
-
-public const string TemplateId = "CSharp_DbContext_Context_EF6";
-
-public class CodeStringGenerator
-{
- private readonly CodeGenerationTools _code;
- private readonly TypeMapper _typeMapper;
- private readonly MetadataTools _ef;
-
- public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
- {
- ArgumentNotNull(code, "code");
- ArgumentNotNull(typeMapper, "typeMapper");
- ArgumentNotNull(ef, "ef");
-
- _code = code;
- _typeMapper = typeMapper;
- _ef = ef;
- }
-
- public string Property(EdmProperty edmProperty)
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} {1} {2} {{ {3}get; {4}set; }}",
- Accessibility.ForProperty(edmProperty),
- _typeMapper.GetTypeName(edmProperty.TypeUsage),
- _code.Escape(edmProperty),
- _code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
- _code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
- }
-
- public string NavigationProperty(NavigationProperty navProp)
- {
- var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} {1} {2} {{ {3}get; {4}set; }}",
- AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
- navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
- _code.Escape(navProp),
- _code.SpaceAfter(Accessibility.ForGetter(navProp)),
- _code.SpaceAfter(Accessibility.ForSetter(navProp)));
- }
-
- public string AccessibilityAndVirtual(string accessibility)
- {
- return accessibility + (accessibility != "private" ? " virtual" : "");
- }
-
- public string EntityClassOpening(EntityType entity)
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} {1}partial class {2}{3}",
- Accessibility.ForType(entity),
- _code.SpaceAfter(_code.AbstractOption(entity)),
- _code.Escape(entity),
- _code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
- }
-
- public string EnumOpening(SimpleType enumType)
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} enum {1} : {2}",
- Accessibility.ForType(enumType),
- _code.Escape(enumType),
- _code.Escape(_typeMapper.UnderlyingClrType(enumType)));
- }
-
- public void WriteFunctionParameters(EdmFunction edmFunction, Action writeParameter)
- {
- var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
- foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
- {
- var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
- var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
- var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
- writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
- }
- }
-
- public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
- {
- var parameters = _typeMapper.GetParameters(edmFunction);
-
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} IQueryable<{1}> {2}({3})",
- AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
- _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
- _code.Escape(edmFunction),
- string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
- }
-
- public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
- {
- var parameters = _typeMapper.GetParameters(edmFunction);
-
- return string.Format(
- CultureInfo.InvariantCulture,
- "return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
- _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
- edmFunction.NamespaceName,
- edmFunction.Name,
- string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
- _code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
- }
-
- public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
- {
- var parameters = _typeMapper.GetParameters(edmFunction);
- var returnType = _typeMapper.GetReturnType(edmFunction);
-
- var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
- if (includeMergeOption)
- {
- paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
- }
-
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} {1} {2}({3})",
- AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
- returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
- _code.Escape(edmFunction),
- paramList);
- }
-
- public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
- {
- var parameters = _typeMapper.GetParameters(edmFunction);
- var returnType = _typeMapper.GetReturnType(edmFunction);
-
- var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
- if (includeMergeOption)
- {
- callParams = ", mergeOption" + callParams;
- }
-
- return string.Format(
- CultureInfo.InvariantCulture,
- "return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
- returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
- edmFunction.Name,
- callParams);
- }
-
- public string DbSet(EntitySet entitySet)
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} virtual DbSet<{1}> {2} {{ get; set; }}",
- Accessibility.ForReadOnlyProperty(entitySet),
- _typeMapper.GetTypeName(entitySet.ElementType),
- _code.Escape(entitySet));
- }
-
- public string DbSetInitializer(EntitySet entitySet)
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} = Set<{1}>();",
- _code.Escape(entitySet),
- _typeMapper.GetTypeName(entitySet.ElementType));
- }
-
- public string UsingDirectives(bool inHeader, bool includeCollections = true)
- {
- return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
- ? string.Format(
- CultureInfo.InvariantCulture,
- "{0}using System;{1}" +
- "{2}",
- inHeader ? Environment.NewLine : "",
- includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
- inHeader ? "" : Environment.NewLine)
- : "";
- }
-}
-
-public class TypeMapper
-{
- private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
-
- private readonly System.Collections.IList _errors;
- private readonly CodeGenerationTools _code;
- private readonly MetadataTools _ef;
-
- public static string FixNamespaces(string typeName)
- {
- return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
- }
-
- public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
- {
- ArgumentNotNull(code, "code");
- ArgumentNotNull(ef, "ef");
- ArgumentNotNull(errors, "errors");
-
- _code = code;
- _ef = ef;
- _errors = errors;
- }
-
- public string GetTypeName(TypeUsage typeUsage)
- {
- return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
- }
-
- public string GetTypeName(EdmType edmType)
- {
- return GetTypeName(edmType, isNullable: null, modelNamespace: null);
- }
-
- public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
- {
- return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
- }
-
- public string GetTypeName(EdmType edmType, string modelNamespace)
- {
- return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
- }
-
- public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
- {
- if (edmType == null)
- {
- return null;
- }
-
- var collectionType = edmType as CollectionType;
- if (collectionType != null)
- {
- return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
- }
-
- var typeName = _code.Escape(edmType.MetadataProperties
- .Where(p => p.Name == ExternalTypeNameAttributeName)
- .Select(p => (string)p.Value)
- .FirstOrDefault())
- ?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
- _code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
- _code.Escape(edmType));
-
- if (edmType is StructuralType)
- {
- return typeName;
- }
-
- if (edmType is SimpleType)
- {
- var clrType = UnderlyingClrType(edmType);
- if (!IsEnumType(edmType))
- {
- typeName = _code.Escape(clrType);
- }
-
- typeName = FixNamespaces(typeName);
-
- return clrType.IsValueType && isNullable == true ?
- String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
- typeName;
- }
-
- throw new ArgumentException("edmType");
- }
-
- public Type UnderlyingClrType(EdmType edmType)
- {
- ArgumentNotNull(edmType, "edmType");
-
- var primitiveType = edmType as PrimitiveType;
- if (primitiveType != null)
- {
- return primitiveType.ClrEquivalentType;
- }
-
- if (IsEnumType(edmType))
- {
- return GetEnumUnderlyingType(edmType).ClrEquivalentType;
- }
-
- return typeof(object);
- }
-
- public object GetEnumMemberValue(MetadataItem enumMember)
- {
- ArgumentNotNull(enumMember, "enumMember");
-
- var valueProperty = enumMember.GetType().GetProperty("Value");
- return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
- }
-
- public string GetEnumMemberName(MetadataItem enumMember)
- {
- ArgumentNotNull(enumMember, "enumMember");
-
- var nameProperty = enumMember.GetType().GetProperty("Name");
- return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
- }
-
- public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
- {
- ArgumentNotNull(enumType, "enumType");
-
- var membersProperty = enumType.GetType().GetProperty("Members");
- return membersProperty != null
- ? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
- : Enumerable.Empty();
- }
-
- public bool EnumIsFlags(EdmType enumType)
- {
- ArgumentNotNull(enumType, "enumType");
-
- var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
- return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
- }
-
- public bool IsEnumType(GlobalItem edmType)
- {
- ArgumentNotNull(edmType, "edmType");
-
- return edmType.GetType().Name == "EnumType";
- }
-
- public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
- {
- ArgumentNotNull(enumType, "enumType");
-
- return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
- }
-
- public string CreateLiteral(object value)
- {
- if (value == null || value.GetType() != typeof(TimeSpan))
- {
- return _code.CreateLiteral(value);
- }
-
- return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
- }
-
- public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable types, string sourceFile)
- {
- ArgumentNotNull(types, "types");
- ArgumentNotNull(sourceFile, "sourceFile");
-
- var hash = new HashSet(StringComparer.InvariantCultureIgnoreCase);
- if (types.Any(item => !hash.Add(item)))
- {
- _errors.Add(
- new CompilerError(sourceFile, -1, -1, "6023",
- String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
- return false;
- }
- return true;
- }
-
- public IEnumerable GetEnumItemsToGenerate(IEnumerable itemCollection)
- {
- return GetItemsToGenerate(itemCollection)
- .Where(e => IsEnumType(e));
- }
-
- public IEnumerable GetItemsToGenerate(IEnumerable itemCollection) where T: EdmType
- {
- return itemCollection
- .OfType()
- .Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
- .OrderBy(i => i.Name);
- }
-
- public IEnumerable GetAllGlobalItems(IEnumerable itemCollection)
- {
- return itemCollection
- .Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
- .Select(g => GetGlobalItemName(g));
- }
-
- public string GetGlobalItemName(GlobalItem item)
- {
- if (item is EdmType)
- {
- return ((EdmType)item).Name;
- }
- else
- {
- return ((EntityContainer)item).Name;
- }
- }
-
- public IEnumerable GetSimpleProperties(EntityType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
- }
-
- public IEnumerable GetSimpleProperties(ComplexType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
- }
-
- public IEnumerable GetComplexProperties(EntityType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
- }
-
- public IEnumerable GetComplexProperties(ComplexType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
- }
-
- public IEnumerable GetPropertiesWithDefaultValues(EntityType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
- }
-
- public IEnumerable GetPropertiesWithDefaultValues(ComplexType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
- }
-
- public IEnumerable GetNavigationProperties(EntityType type)
- {
- return type.NavigationProperties.Where(np => np.DeclaringType == type);
- }
-
- public IEnumerable GetCollectionNavigationProperties(EntityType type)
- {
- return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
- }
-
- public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
- {
- ArgumentNotNull(edmFunction, "edmFunction");
-
- var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
- return returnParamsProperty == null
- ? edmFunction.ReturnParameter
- : ((IEnumerable)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
- }
-
- public bool IsComposable(EdmFunction edmFunction)
- {
- ArgumentNotNull(edmFunction, "edmFunction");
-
- var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
- return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
- }
-
- public IEnumerable GetParameters(EdmFunction edmFunction)
- {
- return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
- }
-
- public TypeUsage GetReturnType(EdmFunction edmFunction)
- {
- var returnParam = GetReturnParameter(edmFunction);
- return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
- }
-
- public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
- {
- var returnType = GetReturnType(edmFunction);
- return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
- }
-}
-
-public static void ArgumentNotNull(T arg, string name) where T : class
-{
- if (arg == null)
- {
- throw new ArgumentNullException(name);
- }
-}
-#>
\ No newline at end of file
diff --git a/Project/ModelJobreport.Designer.cs b/Project/ModelJobreport.Designer.cs
deleted file mode 100644
index cefbeb2..0000000
--- a/Project/ModelJobreport.Designer.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-// 모델 'D:\Source\##### 완료아이템\(0014) GroupWare\Source\Project\ModelJobreport.edmx'에 대해 T4 코드 생성이 사용됩니다.
-// 레거시 코드 생성을 사용하려면 '코드 생성 전략' 디자이너 속성의 값을
-// 'Legacy ObjectContext'로 변경하십시오. 이 속성은 모델이 디자이너에서 열릴 때
-// 속성 창에서 사용할 수 있습니다.
-
-// 컨텍스트 및 엔터티 클래스가 생성되지 않은 경우 빈 모델을 만들었기 때문일 수도 있지만
-// 사용할 Entity Framework 버전을 선택하지 않았기 때문일 수도 있습니다. 모델에 맞는 컨텍스트 클래스 및
-// 엔터티 클래스를 생성하려면 디자이너에서 모델을 열고 디자이너 화면에서 마우스 오른쪽 단추를 클릭한
-// 다음 '데이터베이스에서 모델 업데이트...', '모델에서 데이터베이스 생성...' 또는 '코드 생성 항목 추가...'를
-// 선택하십시오.
\ No newline at end of file
diff --git a/Project/ModelJobreport.cs b/Project/ModelJobreport.cs
deleted file mode 100644
index 7a9ab12..0000000
--- a/Project/ModelJobreport.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 이 코드는 템플릿에서 생성되었습니다.
-//
-// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
-// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
-//
-//------------------------------------------------------------------------------
-
diff --git a/Project/ModelJobreport.edmx b/Project/ModelJobreport.edmx
deleted file mode 100644
index 67c3e6a..0000000
--- a/Project/ModelJobreport.edmx
+++ /dev/null
@@ -1,281 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- SELECT
- [vJobReportForUser].[idx] AS [idx],
- [vJobReportForUser].[pdate] AS [pdate],
- [vJobReportForUser].[gcode] AS [gcode],
- [vJobReportForUser].[id] AS [id],
- [vJobReportForUser].[name] AS [name],
- [vJobReportForUser].[process] AS [process],
- [vJobReportForUser].[type] AS [type],
- [vJobReportForUser].[svalue] AS [svalue],
- [vJobReportForUser].[hrs] AS [hrs],
- [vJobReportForUser].[ot] AS [ot],
- [vJobReportForUser].[requestpart] AS [requestpart],
- [vJobReportForUser].[package] AS [package],
- [vJobReportForUser].[userProcess] AS [userProcess],
- [vJobReportForUser].[status] AS [status],
- [vJobReportForUser].[projectName] AS [projectName],
- [vJobReportForUser].[description] AS [description],
- [vJobReportForUser].[ww] AS [ww],
- [vJobReportForUser].[otStart] AS [otStart],
- [vJobReportForUser].[otEnd] AS [otEnd],
- [vJobReportForUser].[ot2] AS [ot2],
- [vJobReportForUser].[otReason] AS [otReason],
- [vJobReportForUser].[grade] AS [grade],
- [vJobReportForUser].[indate] AS [indate],
- [vJobReportForUser].[outdate] AS [outdate]
- FROM [dbo].[vJobReportForUser] AS [vJobReportForUser]
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Project/ModelJobreport.edmx.diagram b/Project/ModelJobreport.edmx.diagram
deleted file mode 100644
index 7c14c5a..0000000
--- a/Project/ModelJobreport.edmx.diagram
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Project/ModelJobreport.tt b/Project/ModelJobreport.tt
deleted file mode 100644
index d2202c0..0000000
--- a/Project/ModelJobreport.tt
+++ /dev/null
@@ -1,733 +0,0 @@
-<#@ template language="C#" debug="false" hostspecific="true"#>
-<#@ include file="EF6.Utility.CS.ttinclude"#><#@
- output extension=".cs"#><#
-
-const string inputFile = @"ModelJobreport.edmx";
-var textTransform = DynamicTextTransformation.Create(this);
-var code = new CodeGenerationTools(this);
-var ef = new MetadataTools(this);
-var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
-var fileManager = EntityFrameworkTemplateFileManager.Create(this);
-var itemCollection = new EdmMetadataLoader(textTransform.Host, textTransform.Errors).CreateEdmItemCollection(inputFile);
-var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
-
-if (!typeMapper.VerifyCaseInsensitiveTypeUniqueness(typeMapper.GetAllGlobalItems(itemCollection), inputFile))
-{
- return string.Empty;
-}
-
-WriteHeader(codeStringGenerator, fileManager);
-
-foreach (var entity in typeMapper.GetItemsToGenerate(itemCollection))
-{
- fileManager.StartNewFile(entity.Name + ".cs");
- BeginNamespace(code);
-#>
-<#=codeStringGenerator.UsingDirectives(inHeader: false)#>
-<#=codeStringGenerator.EntityClassOpening(entity)#>
-{
-<#
- var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(entity);
- var collectionNavigationProperties = typeMapper.GetCollectionNavigationProperties(entity);
- var complexProperties = typeMapper.GetComplexProperties(entity);
-
- if (propertiesWithDefaultValues.Any() || collectionNavigationProperties.Any() || complexProperties.Any())
- {
-#>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
- public <#=code.Escape(entity)#>()
- {
-<#
- foreach (var edmProperty in propertiesWithDefaultValues)
- {
-#>
- this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
-<#
- }
-
- foreach (var navigationProperty in collectionNavigationProperties)
- {
-#>
- this.<#=code.Escape(navigationProperty)#> = new HashSet<<#=typeMapper.GetTypeName(navigationProperty.ToEndMember.GetEntityType())#>>();
-<#
- }
-
- foreach (var complexProperty in complexProperties)
- {
-#>
- this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
-<#
- }
-#>
- }
-
-<#
- }
-
- var simpleProperties = typeMapper.GetSimpleProperties(entity);
- if (simpleProperties.Any())
- {
- foreach (var edmProperty in simpleProperties)
- {
-#>
- <#=codeStringGenerator.Property(edmProperty)#>
-<#
- }
- }
-
- if (complexProperties.Any())
- {
-#>
-
-<#
- foreach(var complexProperty in complexProperties)
- {
-#>
- <#=codeStringGenerator.Property(complexProperty)#>
-<#
- }
- }
-
- var navigationProperties = typeMapper.GetNavigationProperties(entity);
- if (navigationProperties.Any())
- {
-#>
-
-<#
- foreach (var navigationProperty in navigationProperties)
- {
- if (navigationProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
- {
-#>
- [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
-<#
- }
-#>
- <#=codeStringGenerator.NavigationProperty(navigationProperty)#>
-<#
- }
- }
-#>
-}
-<#
- EndNamespace(code);
-}
-
-foreach (var complex in typeMapper.GetItemsToGenerate(itemCollection))
-{
- fileManager.StartNewFile(complex.Name + ".cs");
- BeginNamespace(code);
-#>
-<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
-<#=Accessibility.ForType(complex)#> partial class <#=code.Escape(complex)#>
-{
-<#
- var complexProperties = typeMapper.GetComplexProperties(complex);
- var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(complex);
-
- if (propertiesWithDefaultValues.Any() || complexProperties.Any())
- {
-#>
- public <#=code.Escape(complex)#>()
- {
-<#
- foreach (var edmProperty in propertiesWithDefaultValues)
- {
-#>
- this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
-<#
- }
-
- foreach (var complexProperty in complexProperties)
- {
-#>
- this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
-<#
- }
-#>
- }
-
-<#
- }
-
- var simpleProperties = typeMapper.GetSimpleProperties(complex);
- if (simpleProperties.Any())
- {
- foreach(var edmProperty in simpleProperties)
- {
-#>
- <#=codeStringGenerator.Property(edmProperty)#>
-<#
- }
- }
-
- if (complexProperties.Any())
- {
-#>
-
-<#
- foreach(var edmProperty in complexProperties)
- {
-#>
- <#=codeStringGenerator.Property(edmProperty)#>
-<#
- }
- }
-#>
-}
-<#
- EndNamespace(code);
-}
-
-foreach (var enumType in typeMapper.GetEnumItemsToGenerate(itemCollection))
-{
- fileManager.StartNewFile(enumType.Name + ".cs");
- BeginNamespace(code);
-#>
-<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
-<#
- if (typeMapper.EnumIsFlags(enumType))
- {
-#>
-[Flags]
-<#
- }
-#>
-<#=codeStringGenerator.EnumOpening(enumType)#>
-{
-<#
- var foundOne = false;
-
- foreach (MetadataItem member in typeMapper.GetEnumMembers(enumType))
- {
- foundOne = true;
-#>
- <#=code.Escape(typeMapper.GetEnumMemberName(member))#> = <#=typeMapper.GetEnumMemberValue(member)#>,
-<#
- }
-
- if (foundOne)
- {
- this.GenerationEnvironment.Remove(this.GenerationEnvironment.Length - 3, 1);
- }
-#>
-}
-<#
- EndNamespace(code);
-}
-
-fileManager.Process();
-
-#>
-<#+
-
-public void WriteHeader(CodeStringGenerator codeStringGenerator, EntityFrameworkTemplateFileManager fileManager)
-{
- fileManager.StartHeader();
-#>
-//------------------------------------------------------------------------------
-//
-// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
-//
-// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
-// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
-//
-//------------------------------------------------------------------------------
-<#=codeStringGenerator.UsingDirectives(inHeader: true)#>
-<#+
- fileManager.EndBlock();
-}
-
-public void BeginNamespace(CodeGenerationTools code)
-{
- var codeNamespace = code.VsNamespaceSuggestion();
- if (!String.IsNullOrEmpty(codeNamespace))
- {
-#>
-namespace <#=code.EscapeNamespace(codeNamespace)#>
-{
-<#+
- PushIndent(" ");
- }
-}
-
-public void EndNamespace(CodeGenerationTools code)
-{
- if (!String.IsNullOrEmpty(code.VsNamespaceSuggestion()))
- {
- PopIndent();
-#>
-}
-<#+
- }
-}
-
-public const string TemplateId = "CSharp_DbContext_Types_EF6";
-
-public class CodeStringGenerator
-{
- private readonly CodeGenerationTools _code;
- private readonly TypeMapper _typeMapper;
- private readonly MetadataTools _ef;
-
- public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
- {
- ArgumentNotNull(code, "code");
- ArgumentNotNull(typeMapper, "typeMapper");
- ArgumentNotNull(ef, "ef");
-
- _code = code;
- _typeMapper = typeMapper;
- _ef = ef;
- }
-
- public string Property(EdmProperty edmProperty)
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} {1} {2} {{ {3}get; {4}set; }}",
- Accessibility.ForProperty(edmProperty),
- _typeMapper.GetTypeName(edmProperty.TypeUsage),
- _code.Escape(edmProperty),
- _code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
- _code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
- }
-
- public string NavigationProperty(NavigationProperty navProp)
- {
- var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} {1} {2} {{ {3}get; {4}set; }}",
- AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
- navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
- _code.Escape(navProp),
- _code.SpaceAfter(Accessibility.ForGetter(navProp)),
- _code.SpaceAfter(Accessibility.ForSetter(navProp)));
- }
-
- public string AccessibilityAndVirtual(string accessibility)
- {
- return accessibility + (accessibility != "private" ? " virtual" : "");
- }
-
- public string EntityClassOpening(EntityType entity)
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} {1}partial class {2}{3}",
- Accessibility.ForType(entity),
- _code.SpaceAfter(_code.AbstractOption(entity)),
- _code.Escape(entity),
- _code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
- }
-
- public string EnumOpening(SimpleType enumType)
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} enum {1} : {2}",
- Accessibility.ForType(enumType),
- _code.Escape(enumType),
- _code.Escape(_typeMapper.UnderlyingClrType(enumType)));
- }
-
- public void WriteFunctionParameters(EdmFunction edmFunction, Action writeParameter)
- {
- var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
- foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
- {
- var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
- var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
- var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
- writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
- }
- }
-
- public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
- {
- var parameters = _typeMapper.GetParameters(edmFunction);
-
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} IQueryable<{1}> {2}({3})",
- AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
- _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
- _code.Escape(edmFunction),
- string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
- }
-
- public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
- {
- var parameters = _typeMapper.GetParameters(edmFunction);
-
- return string.Format(
- CultureInfo.InvariantCulture,
- "return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
- _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
- edmFunction.NamespaceName,
- edmFunction.Name,
- string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
- _code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
- }
-
- public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
- {
- var parameters = _typeMapper.GetParameters(edmFunction);
- var returnType = _typeMapper.GetReturnType(edmFunction);
-
- var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
- if (includeMergeOption)
- {
- paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
- }
-
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} {1} {2}({3})",
- AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
- returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
- _code.Escape(edmFunction),
- paramList);
- }
-
- public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
- {
- var parameters = _typeMapper.GetParameters(edmFunction);
- var returnType = _typeMapper.GetReturnType(edmFunction);
-
- var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
- if (includeMergeOption)
- {
- callParams = ", mergeOption" + callParams;
- }
-
- return string.Format(
- CultureInfo.InvariantCulture,
- "return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
- returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
- edmFunction.Name,
- callParams);
- }
-
- public string DbSet(EntitySet entitySet)
- {
- return string.Format(
- CultureInfo.InvariantCulture,
- "{0} virtual DbSet<{1}> {2} {{ get; set; }}",
- Accessibility.ForReadOnlyProperty(entitySet),
- _typeMapper.GetTypeName(entitySet.ElementType),
- _code.Escape(entitySet));
- }
-
- public string UsingDirectives(bool inHeader, bool includeCollections = true)
- {
- return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
- ? string.Format(
- CultureInfo.InvariantCulture,
- "{0}using System;{1}" +
- "{2}",
- inHeader ? Environment.NewLine : "",
- includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
- inHeader ? "" : Environment.NewLine)
- : "";
- }
-}
-
-public class TypeMapper
-{
- private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
-
- private readonly System.Collections.IList _errors;
- private readonly CodeGenerationTools _code;
- private readonly MetadataTools _ef;
-
- public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
- {
- ArgumentNotNull(code, "code");
- ArgumentNotNull(ef, "ef");
- ArgumentNotNull(errors, "errors");
-
- _code = code;
- _ef = ef;
- _errors = errors;
- }
-
- public static string FixNamespaces(string typeName)
- {
- return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
- }
-
- public string GetTypeName(TypeUsage typeUsage)
- {
- return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
- }
-
- public string GetTypeName(EdmType edmType)
- {
- return GetTypeName(edmType, isNullable: null, modelNamespace: null);
- }
-
- public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
- {
- return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
- }
-
- public string GetTypeName(EdmType edmType, string modelNamespace)
- {
- return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
- }
-
- public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
- {
- if (edmType == null)
- {
- return null;
- }
-
- var collectionType = edmType as CollectionType;
- if (collectionType != null)
- {
- return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
- }
-
- var typeName = _code.Escape(edmType.MetadataProperties
- .Where(p => p.Name == ExternalTypeNameAttributeName)
- .Select(p => (string)p.Value)
- .FirstOrDefault())
- ?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
- _code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
- _code.Escape(edmType));
-
- if (edmType is StructuralType)
- {
- return typeName;
- }
-
- if (edmType is SimpleType)
- {
- var clrType = UnderlyingClrType(edmType);
- if (!IsEnumType(edmType))
- {
- typeName = _code.Escape(clrType);
- }
-
- typeName = FixNamespaces(typeName);
-
- return clrType.IsValueType && isNullable == true ?
- String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
- typeName;
- }
-
- throw new ArgumentException("edmType");
- }
-
- public Type UnderlyingClrType(EdmType edmType)
- {
- ArgumentNotNull(edmType, "edmType");
-
- var primitiveType = edmType as PrimitiveType;
- if (primitiveType != null)
- {
- return primitiveType.ClrEquivalentType;
- }
-
- if (IsEnumType(edmType))
- {
- return GetEnumUnderlyingType(edmType).ClrEquivalentType;
- }
-
- return typeof(object);
- }
-
- public object GetEnumMemberValue(MetadataItem enumMember)
- {
- ArgumentNotNull(enumMember, "enumMember");
-
- var valueProperty = enumMember.GetType().GetProperty("Value");
- return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
- }
-
- public string GetEnumMemberName(MetadataItem enumMember)
- {
- ArgumentNotNull(enumMember, "enumMember");
-
- var nameProperty = enumMember.GetType().GetProperty("Name");
- return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
- }
-
- public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
- {
- ArgumentNotNull(enumType, "enumType");
-
- var membersProperty = enumType.GetType().GetProperty("Members");
- return membersProperty != null
- ? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
- : Enumerable.Empty();
- }
-
- public bool EnumIsFlags(EdmType enumType)
- {
- ArgumentNotNull(enumType, "enumType");
-
- var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
- return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
- }
-
- public bool IsEnumType(GlobalItem edmType)
- {
- ArgumentNotNull(edmType, "edmType");
-
- return edmType.GetType().Name == "EnumType";
- }
-
- public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
- {
- ArgumentNotNull(enumType, "enumType");
-
- return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
- }
-
- public string CreateLiteral(object value)
- {
- if (value == null || value.GetType() != typeof(TimeSpan))
- {
- return _code.CreateLiteral(value);
- }
-
- return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
- }
-
- public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable types, string sourceFile)
- {
- ArgumentNotNull(types, "types");
- ArgumentNotNull(sourceFile, "sourceFile");
-
- var hash = new HashSet(StringComparer.InvariantCultureIgnoreCase);
- if (types.Any(item => !hash.Add(item)))
- {
- _errors.Add(
- new CompilerError(sourceFile, -1, -1, "6023",
- String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
- return false;
- }
- return true;
- }
-
- public IEnumerable GetEnumItemsToGenerate(IEnumerable itemCollection)
- {
- return GetItemsToGenerate(itemCollection)
- .Where(e => IsEnumType(e));
- }
-
- public IEnumerable GetItemsToGenerate(IEnumerable itemCollection) where T: EdmType
- {
- return itemCollection
- .OfType()
- .Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
- .OrderBy(i => i.Name);
- }
-
- public IEnumerable GetAllGlobalItems(IEnumerable itemCollection)
- {
- return itemCollection
- .Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
- .Select(g => GetGlobalItemName(g));
- }
-
- public string GetGlobalItemName(GlobalItem item)
- {
- if (item is EdmType)
- {
- return ((EdmType)item).Name;
- }
- else
- {
- return ((EntityContainer)item).Name;
- }
- }
-
- public IEnumerable GetSimpleProperties(EntityType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
- }
-
- public IEnumerable GetSimpleProperties(ComplexType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
- }
-
- public IEnumerable GetComplexProperties(EntityType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
- }
-
- public IEnumerable GetComplexProperties(ComplexType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
- }
-
- public IEnumerable GetPropertiesWithDefaultValues(EntityType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
- }
-
- public IEnumerable GetPropertiesWithDefaultValues(ComplexType type)
- {
- return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
- }
-
- public IEnumerable GetNavigationProperties(EntityType type)
- {
- return type.NavigationProperties.Where(np => np.DeclaringType == type);
- }
-
- public IEnumerable GetCollectionNavigationProperties(EntityType type)
- {
- return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
- }
-
- public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
- {
- ArgumentNotNull(edmFunction, "edmFunction");
-
- var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
- return returnParamsProperty == null
- ? edmFunction.ReturnParameter
- : ((IEnumerable)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
- }
-
- public bool IsComposable(EdmFunction edmFunction)
- {
- ArgumentNotNull(edmFunction, "edmFunction");
-
- var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
- return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
- }
-
- public IEnumerable GetParameters(EdmFunction edmFunction)
- {
- return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
- }
-
- public TypeUsage GetReturnType(EdmFunction edmFunction)
- {
- var returnParam = GetReturnParameter(edmFunction);
- return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
- }
-
- public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
- {
- var returnType = GetReturnType(edmFunction);
- return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
- }
-}
-
-public static void ArgumentNotNull(T arg, string name) where T : class
-{
- if (arg == null)
- {
- throw new ArgumentNullException(name);
- }
-}
-#>
\ No newline at end of file
diff --git a/Project/ModelProject.Context.cs b/Project/ModelProject.Context.cs
deleted file mode 100644
index 811ae11..0000000
--- a/Project/ModelProject.Context.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-//------------------------------------------------------------------------------
-//
-// 이 코드는 템플릿에서 생성되었습니다.
-//
-// 이 파일을 수동으로 변경하면 응용 프로그램에서 예기치 않은 동작이 발생할 수 있습니다.
-// 이 파일을 수동으로 변경하면 코드가 다시 생성될 때 변경 내용을 덮어씁니다.
-//
-//------------------------------------------------------------------------------
-
-namespace Project
-{
- using System;
- using System.Data.Entity;
- using System.Data.Entity.Infrastructure;
-
- public partial class EEEntitiesProject : DbContext
- {
- public EEEntitiesProject()
- : base("name=EEEntitiesProject")
- {
- }
-
- protected override void OnModelCreating(DbModelBuilder modelBuilder)
- {
- throw new UnintentionalCodeFirstException();
- }
-
- public virtual DbSet EETGW_ProjecthistoryD { get; set; }
- public virtual DbSet EETGW_ProjectToDo { get; set; }
- public virtual DbSet