void IContentRepository.CreateContentItem(ContentItem item) { using (var dc = new ContentDataContext(_connectionFactory.CreateConnection())) { dc.ContentItemEntities.InsertOnSubmit(item.Map()); dc.SubmitChanges(); } }
void IContentRepository.DeleteContentItem(Guid id) { using (var dc = new ContentDataContext(_connectionFactory.CreateConnection())) { var entity = new ContentItemEntity { id = id, deleted = false }; dc.ContentItemEntities.Attach(entity); entity.deleted = true; dc.SubmitChanges(); } }
void IContentRepository.UpdateContentItem(ContentItem item) { using (var dc = new ContentDataContext(_connectionFactory.CreateConnection())) { var entity = GetContentItemEntity(dc, item.Id); if (entity != null) { // Remove everything on the current entity because it will be replaced. DeleteProperties(dc, entity); item.MapTo(entity); dc.SubmitChanges(); } } }