Beispiel #1
0
 void IContentRepository.CreateContentItem(ContentItem item)
 {
     using (var dc = new ContentDataContext(_connectionFactory.CreateConnection()))
     {
         dc.ContentItemEntities.InsertOnSubmit(item.Map());
         dc.SubmitChanges();
     }
 }
Beispiel #2
0
 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();
     }
 }
Beispiel #3
0
        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();
                }
            }
        }