コード例 #1
0
        public List <DiscussionDetail> GetComments(int discussionId)
        {
            using (TransactionScope trans = new TransactionScope())
            {
                try
                {
                    using (gulam786_HurufEntities _db = new gulam786_HurufEntities())
                    {
                        var discussions = (from d in _db.DiscussionComments
                                           join u in _db.UserRegisters on d.CommentBy equals u.RegistrationID
                                           where d.DiscusssionID == discussionId
                                           select new DiscussionDetail
                        {
                            DiscusssionID = d.DiscusssionID,
                            Description = d.Comment,
                            PostedDate = d.CommentDate,
                            FileName = u.FileName,
                            FullName = u.FirstName + " " + u.LastName
                        }).ToList();

                        trans.Complete();
                        return(discussions);
                    }
                }
                catch (Exception ex)
                {
                    trans.Dispose();
                    throw ex;
                }
                finally
                {
                    trans.Dispose();
                }
            }
        }
コード例 #2
0
 public RepsistoryEF(bool DisableLazyLoading)
 {
     _db = new gulam786_HurufEntities();
     _db.Configuration.LazyLoadingEnabled = DisableLazyLoading;
 }
コード例 #3
0
 public RepsistoryEF()
 {
     _db = new gulam786_HurufEntities();
 }