开发者

Entity framework - debugging problem with no unhandled exceptions

I am performing a create operation on an entity. The entity is a Function import of a stored procedure. No exceptions are thrown, but I am getting nothing new in the database. I checked my connection string a couple times, pointing to Dev environment like it should. I stuck on breakpoint on the ObjectResult<T> and it hit and flows through to return View(). What else can I do to debug/troubleshoot this?

[HttpPost]
        public ActionResult Create(Tracker_CreateUser_Result model开发者_高级运维)
        {
            string currentUser = Environment.UserDomainName + "\\" + Environment.UserName;
            TrackerEntities context = new TrackerEntities();

            model.User_Created_Date = DateTime.Now;
            model.User_Created_Logon_Name = currentUser;
            model.User_Updated_Logon_Name = currentUser;
            model.User_Updated_Datetime = DateTime.Now;
            System.Data.Objects.ObjectResult<Tracker_CreateUser_Result> result = context.Tracker_CreateUser(model.User_Name,model.User_Logon_Name,model.User_Token,model.User_Demo,model.User_Demo_Logon_Name,model.User_Interface,model.User_Status,model.User_Reason_for_Edit,model.User_Created_Logon_Name,model.User_Created_Date,model.User_Updated_Logon_Name,model.User_Updated_Datetime);
            context.SaveChanges();//UPDATE
            ViewBag.Message = "Successfully created user";
            return View();
        }


You should call context.SaveChanges() after adding the entity.

Hope this helps :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜