C#, .NET, .Net Core
ASP.NET MVC, ASP.NET Web Forms, ASP.NET Core
HTML 5, CSS 3, Javascript, jQuery, Bootstrap
Entity Framework, NHibernate, Dapper
Sql Server, MySql, Oracle
Windows Server, Ubuntu, Debian, Pardus
Xamarin Forms, Android Studio
--- The future of the open web platform is looking very bright!
--- .NET is a free, cross-platform, open source developer platform for building any app.
Google Analytics İzleme
29 Aralık 2011
entity framework ve automapper kullanımı; DTO'dan Entity'e atama
Örnek Yazım:
public void Update(BusinessObject.Setting pSetting)
{
using (var dbContext = new AppDBEntities())
{
EFModel.OKFormSetting record = (from r in dbContext.OKFormSetting
where r.SettingCode.Equals(pSetting.SettingCode)
select r).FirstOrDefault();
Mapper.CreateMap<BusinessObject.Setting, EFModel.OKFormSetting>()
.ForMember(dest => dest.EntityKey, opt => opt.Ignore());
record = Mapper.Map<BusinessObject.Setting, EFModel.OKFormSetting>(pSetting,record);
Mapper.AssertConfigurationIsValid();
dbContext.SaveChanges();
}
}
Kaynak:
http://groups.google.com/group/automapper-users/browse_thread/thread/24a90f22323a27bc?fwc=1&pli=1
http://www.devtrends.co.uk/blog/stop-using-automapper-in-your-data-access-code
Kaydol:
Kayıt Yorumları (Atom)
Hiç yorum yok:
Yorum Gönder