您好,登錄后才能下訂單哦!
如果你還不了解Green.AgileMapper的用意,作用請先一步到上篇Green.AgileMapper開源項目的使用,如果你覺得運行時(Runtime)的Mapper效率存在問題,在這個版本中有了更新,新增了C#直接代碼的生成,這里的生成都已3.0后的擴展方法實現,你可以很方便的一句代碼實現兩者的轉化。
代碼生成我本想利用T4模板,但是由于我們的項目IDE版本是VS2008,對于T4的參數傳遞支持還不是很友好,你可能說用AppDomain.SetData,或者CallContext.LogicalSetData,但是可惜我們的餓MappingRule是不可序列化的,所以最后我只得采用了字符串拼接最笨的辦法,為了應對生成策略不同,在這里我們加入了策略模式來應付,來看看代碼結構吧:
在這里只支持對do的二級屬性映射為dto的平面屬性,全部針對IMappingRule生成代碼,在這里為了生成合法的代碼而非表達式,對以前的表達式進行了重新的標準約定,在代碼注釋。以及對上個版本的List轉換進行了多次重載,主要為了滿足DTo到DO對象的特殊要求,因為我們在領域開發存儲DTO的時候都是需要先取出DO對象在根據DTO在DO對象的基礎上進行修改,以便ORM領域框架或者UOW的跟蹤記錄。
下面看看任然是上個測試類模型的代碼生成(在這里測試DO,DTO類進行了重構為了更全面的測試,具體請看CodePlex http://agilemapper.codeplex.com/代碼):
- StudenDo stu = new StudenDo()
- {
- ID = 1,
- Name = "test1",
- Sex = Sex.女,
- Address = new Address()
- {
- Country = "中國",
- Province = "四川",
- Street = "高新區"
- },
- CourseIds = new List<string>() { "1", "2", "3" },
- Propertys = new List<KeyValuePair>() { new KeyValuePair() { Key = "1", Value = "1" } },
- ContactWay = new ContactWay()
- {
- Phone = "1111111111111111",
- Email = "xxxx@12f",
- QQ = "7889789999889"
- }
- };
- Func<StudenDo, StudenDo, bool> fun = (f, j) => f.ID == j.ID;
- var s = fun.ToString();
- var mapper = ObjectMapperManager.Default.GetMapper<StudenDto, StudenDo>();
- mapper.AgileMapperTemplateStrategy.DefaultEqualExpression = "{0}.ID == {1}.ID && {1}.ID != 0";
- var str1 = mapper.CodeGenerator();
- System.IO.File.Delete(@"E:\Project\OpenSource\AgileMapper\AgileMappper.Test\CodeTemplate.Test\1.cs");
- System.IO.File.AppendAllText(@"E:\Project\OpenSource\AgileMapper\AgileMappper.Test\CodeTemplate.Test\1.cs", str1);
- var mapper1 = ObjectMapperManager.Default.GetMapper<ContactWayDto, ContactWay>();
- str1 = mapper1.CodeGenerator();
- System.IO.File.Delete(@"E:\Project\OpenSource\AgileMapper\AgileMappper.Test\CodeTemplate.Test\2.cs");
- System.IO.File.AppendAllText(@"E:\Project\OpenSource\AgileMapper\AgileMappper.Test\CodeTemplate.Test\2.cs", str1);
- var mapper2 = ObjectMapperManager.Default.GetMapper<KeyValuePairDto, KeyValuePair>();
- str1 = mapper2.CodeGenerator();
- System.IO.File.Delete(@"E:\Project\OpenSource\AgileMapper\AgileMappper.Test\CodeTemplate.Test\3.cs");
- System.IO.File.AppendAllText(@"E:\Project\OpenSource\AgileMapper\AgileMappper.Test\CodeTemplate.Test\3.cs", str1);
最后的生成文件:
- 1.cs:
- using System;
- using System.Linq;
- using System.Data;
- using System.Collections.Generic;
- namespace Green.AgileMapper
- {
- public static partial class AgileMapperMapping
- {
- /// <summary>
- /// Green.AgileMapper.Test.StudenDto Warp fromObj Green.AgileMapper.Test.StudenDo;
- /// </summary>
- /// <param name="domainObj">Green.AgileMapper.Test.StudenDo</param>
- /// <returns>Green.AgileMapper.Test.StudenDto</returns>
- public static Green.AgileMapper.Test.StudenDto Warp(this Green.AgileMapper.Test.StudenDo domainObj)
- {
- var fromObj = new Green.AgileMapper.Test.StudenDto();
- fromObj.ID = domainObj.ID;
- fromObj.Name = domainObj.Name;
- fromObj.Sex = domainObj.Sex;
- if (domainObj.Address != null)
- {
- fromObj.Country = domainObj.Address.Country;
- fromObj.Province = domainObj.Address.Province;
- }
- fromObj.Particular = domainObj.Address.Country + " 國籍 " + domainObj.Address.Province + " 省 ";
- fromObj.FirstPropertyKey = domainObj.Propertys[0].Key;
- if (domainObj.ContactWay != null)
- {
- fromObj.ContactWay = domainObj.ContactWay.Warp();
- }
- if (domainObj.CourseIds != null)
- {
- fromObj.CourseIds = new List<System.String>();
- foreach (var item_CourseIds in domainObj.CourseIds)
- {
- fromObj.CourseIds.Add(item_CourseIds);
- }
- }
- if (domainObj.Propertys != null)
- {
- fromObj.Propertys = domainObj.Propertys.Warp();
- }
- return fromObj;
- }
- /// <summary>
- /// Green.AgileMapper.Test.StudenDto Warp domainObj Green.AgileMapper.Test.StudenDo;
- /// </summary>
- /// <param name="domainObj">Green.AgileMapper.Test.StudenDo</param>
- /// <returns>fromObj</returns>
- public static void Warp(this Green.AgileMapper.Test.StudenDto fromObj, Green.AgileMapper.Test.StudenDo domainObj)
- {
- if (fromObj == null)
- {
- return;
- }
- if (domainObj == null)
- {
- domainObj = new Green.AgileMapper.Test.StudenDo();
- }
- domainObj.ID = fromObj.ID;
- domainObj.Name = fromObj.Name;
- domainObj.Sex = fromObj.Sex;
- if (domainObj.Address == null)
- {
- domainObj.Address = new Green.AgileMapper.Test.Address();
- }
- domainObj.Address.Country = fromObj.Country;
- domainObj.Address.Province = fromObj.Province;
- if (domainObj.ContactWay == null)
- {
- domainObj.ContactWay = new Green.AgileMapper.Test.ContactWay();
- }
- fromObj.ContactWay.Warp(domainObj.ContactWay);
- if (fromObj.CourseIds != null)
- {
- if (domainObj.CourseIds == null)
- {
- domainObj.CourseIds = new List<System.String>();
- }
- domainObj.CourseIds.Clear();
- foreach (var item_CourseIds in fromObj.CourseIds)
- {
- domainObj.CourseIds.Add(item_CourseIds);
- }
- }
- if (fromObj.Propertys != null)
- {
- if (domainObj.Propertys == null)
- {
- domainObj.Propertys = new List<Green.AgileMapper.Test.KeyValuePair>();
- }
- fromObj.Propertys.Warp(domainObj.Propertys, (fromObjItem, domainObjItem) => fromObjItem.Key == domainObjItem.Key, true);
- }
- }
- /// <summary>
- /// Green.AgileMapper.Test.StudenDto collection Warp fromObj Green.AgileMapper.Test.StudenDo collection;
- /// </summary>
- /// <param name="form">Green.AgileMapper.Test.StudenDto collection</param>
- /// <param name="domainObj">Green.AgileMapper.Test.StudenDo collection</param>
- public static List<Green.AgileMapper.Test.StudenDto> Warp(this IList<Green.AgileMapper.Test.StudenDo> domainObj)
- {
- List<Green.AgileMapper.Test.StudenDto> froms = new List<Green.AgileMapper.Test.StudenDto>();
- domainObj.ToList().ForEach(t =>
- {
- froms.Add(Warp(t));
- });
- return froms;
- }
- /// <summary>
- /// Green.AgileMapper.Test.StudenDto collection Warp domainObj Green.AgileMapper.Test.StudenDo collection;
- /// </summary>
- /// <param name="fromObj">Green.AgileMapper.Test.StudenDto collection</param>
- /// <param name="domainObj">Green.AgileMapper.Test.StudenDo collection</param>
- public static void Warp(this IList<Green.AgileMapper.Test.StudenDto> fromObj, IList<Green.AgileMapper.Test.StudenDo> domainObj)
- {
- fromObj.Warp(domainObj, (fromObjItem, domainObjItem) => fromObjItem.ID == domainObjItem.ID && domainObjItem.ID != 0, false);
- }
- /// <summary>
- /// Green.AgileMapper.Test.StudenDto collection Warp domainObj Green.AgileMapper.Test.StudenDo collection;
- /// </summary>
- /// <param name="fromObj">Green.AgileMapper.Test.StudenDto collection</param>
- /// <param name="domainObj">Green.AgileMapper.Test.StudenDo collection</param>
- /// <param name="isDeleteNotInFromItem">Delete the item that not in From collection</param>
- public static void Warp(this IList<Green.AgileMapper.Test.StudenDto> fromObj, IList<Green.AgileMapper.Test.StudenDo> domainObj, bool isDeleteNotInFromItem)
- {
- fromObj.Warp(domainObj, (fromObjItem, domainObjItem) => fromObjItem.ID == domainObjItem.ID && domainObjItem.ID != 0, isDeleteNotInFromItem);
- }
- /// <summary>
- /// Green.AgileMapper.Test.StudenDto collection Warp domainObj Green.AgileMapper.Test.StudenDo collection;
- /// </summary>
- /// <param name="fromObj">Green.AgileMapper.Test.StudenDto collection</param>
- /// <param name="domainObj">Green.AgileMapper.Test.StudenDo collection</param>
- /// <param name="equalPredicate">the from item equal to item expression</param>
- public static void Warp(this IList<Green.AgileMapper.Test.StudenDto> fromObj, IList<Green.AgileMapper.Test.StudenDo> domainObj, Func<Green.AgileMapper.Test.StudenDto, Green.AgileMapper.Test.StudenDo, bool> equalPredicate)
- {
- fromObj.Warp(domainObj, equalPredicate, false);
- }
- /// <summary>
- /// Green.AgileMapper.Test.StudenDto collection Warp domainObj Green.AgileMapper.Test.StudenDo collection;
- /// </summary>
- /// <param name="fromObj">Green.AgileMapper.Test.StudenDto collection</param>
- /// <param name="domainObj">Green.AgileMapper.Test.StudenDo collection</param>
- /// <param name="equalPredicate">the from item equal to item expression</param>
- /// <param name="isDeleteNotInFromItem">Delete the item that not in From collection</param>
- public static void Warp(this IList<Green.AgileMapper.Test.StudenDto> fromObj, IList<Green.AgileMapper.Test.StudenDo> domainObj, Func<Green.AgileMapper.Test.StudenDto, Green.AgileMapper.Test.StudenDo, bool> equalPredicate, bool isDeleteNotInFromItem)
- {
- if (fromObj == null)
- {
- return;
- }
- if (domainObj == null)
- {
- domainObj = new List<Green.AgileMapper.Test.StudenDo>();
- }
- fromObj.ToList().ForEach(fromObjItem =>
- {
- Green.AgileMapper.Test.StudenDo toItem = default(Green.AgileMapper.Test.StudenDo);
- if (equalPredicate != null)
- {
- toItem = domainObj.SingleOrDefault(domainObjItem => equalPredicate(fromObjItem, domainObjItem));
- }
- if (toItem == null)
- {
- toItem = new Green.AgileMapper.Test.StudenDo();
- domainObj.Add(toItem);
- }
- Warp(fromObjItem, toItem);
- });
- if (isDeleteNotInFromItem)
- {
- domainObj.Where(domainObjItem => fromObj.FirstOrDefault(fromObjItem => equalPredicate(fromObjItem, domainObjItem)) == null)
- .ToList().ForEach(t =>
- {
- domainObj.Remove(t);
- });
- }
- }
- }
- }
- 2.cs
- using System;
- using System.Linq;
- using System.Data;
- using System.Collections.Generic;
- namespace Green.AgileMapper
- {
- public static partial class AgileMapperMapping
- {
- /// <summary>
- /// Green.AgileMapper.Test.ContactWayDto Warp fromObj Green.AgileMapper.Test.ContactWay;
- /// </summary>
- /// <param name="domainObj">Green.AgileMapper.Test.ContactWay</param>
- /// <returns>Green.AgileMapper.Test.ContactWayDto</returns>
- public static Green.AgileMapper.Test.ContactWayDto Warp(this Green.AgileMapper.Test.ContactWay domainObj)
- {
- var fromObj = new Green.AgileMapper.Test.ContactWayDto();
- fromObj.Phone = domainObj.Phone;
- fromObj.Email = domainObj.Email;
- fromObj.QQ = domainObj.QQ;
- return fromObj;
- }
- /// <summary>
- /// Green.AgileMapper.Test.ContactWayDto Warp domainObj Green.AgileMapper.Test.ContactWay;
- /// </summary>
- /// <param name="domainObj">Green.AgileMapper.Test.ContactWay</param>
- /// <returns>fromObj</returns>
- public static void Warp(this Green.AgileMapper.Test.ContactWayDto fromObj, Green.AgileMapper.Test.ContactWay domainObj)
- {
- if (fromObj == null)
- {
- return;
- }
- if (domainObj == null)
- {
- domainObj = new Green.AgileMapper.Test.ContactWay();
- }
- domainObj.Phone = fromObj.Phone;
- domainObj.Email = fromObj.Email;
- domainObj.QQ = fromObj.QQ;
- }
- /// <summary>
- /// Green.AgileMapper.Test.ContactWayDto collection Warp fromObj Green.AgileMapper.Test.ContactWay collection;
- /// </summary>
- /// <param name="form">Green.AgileMapper.Test.ContactWayDto collection</param>
- /// <param name="domainObj">Green.AgileMapper.Test.ContactWay collection</param>
- public static List<Green.AgileMapper.Test.ContactWayDto> Warp(this IList<Green.AgileMapper.Test.ContactWay> domainObj)
- {
- List<Green.AgileMapper.Test.ContactWayDto> froms = new List<Green.AgileMapper.Test.ContactWayDto>();
- domainObj.ToList().ForEach(t =>
- {
- froms.Add(Warp(t));
- });
- return froms;
- }
- /// <summary>
- /// Green.AgileMapper.Test.ContactWayDto collection Warp domainObj Green.AgileMapper.Test.ContactWay collection;
- /// </summary>
- /// <param name="fromObj">Green.AgileMapper.Test.ContactWayDto collection</param>
- /// <param name="domainObj">Green.AgileMapper.Test.ContactWay collection</param>
- public static void Warp(this IList<Green.AgileMapper.Test.ContactWayDto> fromObj, IList<Green.AgileMapper.Test.ContactWay> domainObj)
- {
- fromObj.Warp(domainObj, (fromObjItem, domainObjItem) => fromObjItem.Equals(domainObjItem), false);
- }
- /// <summary>
- /// Green.AgileMapper.Test.ContactWayDto collection Warp domainObj Green.AgileMapper.Test.ContactWay collection;
- /// </summary>
- /// <param name="fromObj">Green.AgileMapper.Test.ContactWayDto collection</param>
- /// <param name="domainObj">Green.AgileMapper.Test.ContactWay collection</param>
- /// <param name="isDeleteNotInFromItem">Delete the item that not in From collection</param>
- public static void Warp(this IList<Green.AgileMapper.Test.ContactWayDto> fromObj, IList<Green.AgileMapper.Test.ContactWay> domainObj, bool isDeleteNotInFromItem)
- {
- fromObj.Warp(domainObj, (fromObjItem, domainObjItem) => fromObjItem.Equals(domainObjItem), isDeleteNotInFromItem);
- }
- /// <summary>
- /// Green.AgileMapper.Test.ContactWayDto collection Warp domainObj Green.AgileMapper.Test.ContactWay collection;
- /// </summary>
- /// <param name="fromObj">Green.AgileMapper.Test.ContactWayDto collection</param>
- /// <param name="domainObj">Green.AgileMapper.Test.ContactWay collection</param>
- /// <param name="equalPredicate">the from item equal to item expression</param>
- public static void Warp(this IList<Green.AgileMapper.Test.ContactWayDto> fromObj, IList<Green.AgileMapper.Test.ContactWay> domainObj, Func<Green.AgileMapper.Test.ContactWayDto, Green.AgileMapper.Test.ContactWay, bool> equalPredicate)
- {
- fromObj.Warp(domainObj, equalPredicate, false);
- }
- /// <summary>
- /// Green.AgileMapper.Test.ContactWayDto collection Warp domainObj Green.AgileMapper.Test.ContactWay collection;
- /// </summary>
- /// <param name="fromObj">Green.AgileMapper.Test.ContactWayDto collection</param>
- /// <param name="domainObj">Green.AgileMapper.Test.ContactWay collection</param>
- /// <param name="equalPredicate">the from item equal to item expression</param>
- /// <param name="isDeleteNotInFromItem">Delete the item that not in From collection</param>
- public static void Warp(this IList<Green.AgileMapper.Test.ContactWayDto> fromObj, IList<Green.AgileMapper.Test.ContactWay> domainObj, Func<Green.AgileMapper.Test.ContactWayDto, Green.AgileMapper.Test.ContactWay, bool> equalPredicate, bool isDeleteNotInFromItem)
- {
- if (fromObj == null)
- {
- return;
- }
- if (domainObj == null)
- {
- domainObj = new List<Green.AgileMapper.Test.ContactWay>();
- }
- fromObj.ToList().ForEach(fromObjItem =>
- {
- Green.AgileMapper.Test.ContactWay toItem = default(Green.AgileMapper.Test.ContactWay);
- if (equalPredicate != null)
- {
- toItem = domainObj.SingleOrDefault(domainObjItem => equalPredicate(fromObjItem, domainObjItem));
- }
- if (toItem == null)
- {
- toItem = new Green.AgileMapper.Test.ContactWay();
- domainObj.Add(toItem);
- }
- Warp(fromObjItem, toItem);
- });
- if (isDeleteNotInFromItem)
- {
- domainObj.Where(domainObjItem => fromObj.FirstOrDefault(fromObjItem => equalPredicate(fromObjItem, domainObjItem)) == null)
- .ToList().ForEach(t =>
- {
- domainObj.Remove(t);
- });
- }
- }
- }
- }
- 3.cs:
- using System;
- using System.Linq;
- using System.Data;
- using System.Collections.Generic;
- namespace Green.AgileMapper
- {
- public static partial class AgileMapperMapping
- {
- /// <summary>
- /// Green.AgileMapper.Test.KeyValuePairDto Warp fromObj Green.AgileMapper.Test.KeyValuePair;
- /// </summary>
- /// <param name="domainObj">Green.AgileMapper.Test.KeyValuePair</param>
- /// <returns>Green.AgileMapper.Test.KeyValuePairDto</returns>
- public static Green.AgileMapper.Test.KeyValuePairDto Warp(this Green.AgileMapper.Test.KeyValuePair domainObj)
- {
- var fromObj = new Green.AgileMapper.Test.KeyValuePairDto();
- fromObj.Key = domainObj.Key;
- fromObj.Value = domainObj.Value;
- return fromObj;
- }
- /// <summary>
- /// Green.AgileMapper.Test.KeyValuePairDto Warp domainObj Green.AgileMapper.Test.KeyValuePair;
- /// </summary>
- /// <param name="domainObj">Green.AgileMapper.Test.KeyValuePair</param>
- /// <returns>fromObj</returns>
- public static void Warp(this Green.AgileMapper.Test.KeyValuePairDto fromObj, Green.AgileMapper.Test.KeyValuePair domainObj)
- {
- if (fromObj == null)
- {
- return;
- }
- if (domainObj == null)
- {
- domainObj = new Green.AgileMapper.Test.KeyValuePair();
- }
- domainObj.Key = fromObj.Key;
- domainObj.Value = fromObj.Value;
- }
- /// <summary>
- /// Green.AgileMapper.Test.KeyValuePairDto collection Warp fromObj Green.AgileMapper.Test.KeyValuePair collection;
- /// </summary>
- /// <param name="form">Green.AgileMapper.Test.KeyValuePairDto collection</param>
- /// <param name="domainObj">Green.AgileMapper.Test.KeyValuePair collection</param>
- public static List<Green.AgileMapper.Test.KeyValuePairDto> Warp(this IList<Green.AgileMapper.Test.KeyValuePair> domainObj)
- {
- List<Green.AgileMapper.Test.KeyValuePairDto> froms = new List<Green.AgileMapper.Test.KeyValuePairDto>();
- domainObj.ToList().ForEach(t =>
- {
- froms.Add(Warp(t));
- });
- return froms;
- }
- /// <summary>
- /// Green.AgileMapper.Test.KeyValuePairDto collection Warp domainObj Green.AgileMapper.Test.KeyValuePair collection;
- /// </summary>
- /// <param name="fromObj">Green.AgileMapper.Test.KeyValuePairDto collection</param>
- /// <param name="domainObj">Green.AgileMapper.Test.KeyValuePair collection</param>
- public static void Warp(this IList<Green.AgileMapper.Test.KeyValuePairDto> fromObj, IList<Green.AgileMapper.Test.KeyValuePair> domainObj)
- {
- fromObj.Warp(domainObj, (fromObjItem, domainObjItem) => fromObjItem.Equals(domainObjItem), false);
- }
- /// <summary>
- /// Green.AgileMapper.Test.KeyValuePairDto collection Warp domainObj Green.AgileMapper.Test.KeyValuePair collection;
- /// </summary>
- /// <param name="fromObj">Green.AgileMapper.Test.KeyValuePairDto collection</param>
- /// <param name="domainObj">Green.AgileMapper.Test.KeyValuePair collection</param>
- /// <param name="isDeleteNotInFromItem">Delete the item that not in From collection</param>
- public static void Warp(this IList<Green.AgileMapper.Test.KeyValuePairDto> fromObj, IList<Green.AgileMapper.Test.KeyValuePair> domainObj, bool isDeleteNotInFromItem)
- {
- fromObj.Warp(domainObj, (fromObjItem, domainObjItem) => fromObjItem.Equals(domainObjItem), isDeleteNotInFromItem);
- }
- /// <summary>
- /// Green.AgileMapper.Test.KeyValuePairDto collection Warp domainObj Green.AgileMapper.Test.KeyValuePair collection;
- /// </summary>
- /// <param name="fromObj">Green.AgileMapper.Test.KeyValuePairDto collection</param>
- /// <param name="domainObj">Green.AgileMapper.Test.KeyValuePair collection</param>
- /// <param name="equalPredicate">the from item equal to item expression</param>
- public static void Warp(this IList<Green.AgileMapper.Test.KeyValuePairDto> fromObj, IList<Green.AgileMapper.Test.KeyValuePair> domainObj, Func<Green.AgileMapper.Test.KeyValuePairDto, Green.AgileMapper.Test.KeyValuePair, bool> equalPredicate)
- {
- fromObj.Warp(domainObj, equalPredicate, false);
- }
- /// <summary>
- /// Green.AgileMapper.Test.KeyValuePairDto collection Warp domainObj Green.AgileMapper.Test.KeyValuePair collection;
- /// </summary>
- /// <param name="fromObj">Green.AgileMapper.Test.KeyValuePairDto collection</param>
- /// <param name="domainObj">Green.AgileMapper.Test.KeyValuePair collection</param>
- /// <param name="equalPredicate">the from item equal to item expression</param>
- /// <param name="isDeleteNotInFromItem">Delete the item that not in From collection</param>
- public static void Warp(this IList<Green.AgileMapper.Test.KeyValuePairDto> fromObj, IList<Green.AgileMapper.Test.KeyValuePair> domainObj, Func<Green.AgileMapper.Test.KeyValuePairDto, Green.AgileMapper.Test.KeyValuePair, bool> equalPredicate, bool isDeleteNotInFromItem)
- {
- if (fromObj == null)
- {
- return;
- }
- if (domainObj == null)
- {
- domainObj = new List<Green.AgileMapper.Test.KeyValuePair>();
- }
- fromObj.ToList().ForEach(fromObjItem =>
- {
- Green.AgileMapper.Test.KeyValuePair toItem = default(Green.AgileMapper.Test.KeyValuePair);
- if (equalPredicate != null)
- {
- toItem = domainObj.SingleOrDefault(domainObjItem => equalPredicate(fromObjItem, domainObjItem));
- }
- if (toItem == null)
- {
- toItem = new Green.AgileMapper.Test.KeyValuePair();
- domainObj.Add(toItem);
- }
- Warp(fromObjItem, toItem);
- });
- if (isDeleteNotInFromItem)
- {
- domainObj.Where(domainObjItem => fromObj.FirstOrDefault(fromObjItem => equalPredicate(fromObjItem, domainObjItem)) == null)
- .ToList().ForEach(t =>
- {
- domainObj.Remove(t);
- });
- }
- }
- }
- }
在這里的代碼生產后很亂并未格式化處理,需要我們在VS中自動Ctrl+K+D格式,如果你希望生成時候就幫助格式化了的話,你可以參見工具CoolFormat源代碼格式化,安裝工具利用CMD命令批量格式化(可以參見百度百科:http://baike.baidu.com/view/4367725.htm)。在項目暫不會考慮這塊,如果你有興趣的可以先幫助完成,謝謝。
具體請參見項目,存在任何問題或者bug可以隨時給我留言,謝謝。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。