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())
var newTopic = new Topic
Category = forumCategory,
Name = "Title",
MemberId = intMemberId
topic = Dialogue.Logic.Services.ServiceFactory.TopicService.Add(newTopic);
// Commit the transaction
catch (Exception ex)
// Roll back database changes
// 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:
Image will be uploaded when post is submitted