Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Sorry, probable "stupid question" alert! Is the code below the correct approach if I want to add topics via code?
var unitofWorkManager = new UnitOfWorkManager(ContextPerRequest.Db); Topic topic = null; using (var unitOfWork = unitofWorkManager.NewUnitOfWork()) { try { var newTopic = new Topic { Category = forumCategory, Name = "Title", MemberId = intMemberId }; topic = Dialogue.Logic.Services.ServiceFactory.TopicService.Add(newTopic); // Commit the transaction unitOfWork.Commit(); } catch (Exception ex) { // Roll back database changes unitOfWork.Rollback(); // Log the error } }
I have read this https://github.com/YodasMyDad/Dialogue#servicefactory--unitofwork which is where the code sample comes from, but I just wanted to check I needed the "unitofwork" stuff.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Using API - is this right
Sorry, probable "stupid question" alert! Is the code below the correct approach if I want to add topics via code?
I have read this https://github.com/YodasMyDad/Dialogue#servicefactory--unitofwork which is where the code sample comes from, but I just wanted to check I needed the "unitofwork" stuff.
is working on a reply...