c# - session object is null after update -
I am populating an object model with a linq query. The model looks like this:
MyModel {Date time from the appointment {get; Set;} Intel TotalAppoints {get; Set;} obtaining environments {receive; Set;}} The linq-to-sql query looks like this:
public stable GetAppointsFromDB (parameter) {var MyQuery = from ... .where ... Select new MyModel {AppointDate = ..., TotalAppoints = ..., AppointDuration = ...}; Return microdel as mycodel;} In the master page, I want to load the result of this question in session:
If (session [ "Appointment"] == faucet {session ["appointment"] = GetAppointsFromDB (...);} When I run from code, the session is always nullified. I added this line a second time, just right after that, and the query runs again. When I'm looking to use the session at some other point in the code, then it is also zero there also the query works because when I put a breakpoint on the return statement, the object is filled in properly is.
Please tell me where the problem is coming from, I seem to be stuck on the simple problem and I 'm seeing what I am doing wrong.
Thank you for your suggestions.
public stable GetAppointsFromDB (params) {var MyQuery = from .... where .. Select new MyModel {AppointDate = ..., TotalAppoints = ..., AppointDuration = ...}; Return Microsoft as MyModel; } Assume that this method actually returns MyModel , therefore: public static MyModel GetAppointsFromDB (parameter) What you are seeing now is that MyYcle can not be inserted on some MyModel , this is the reason Is that empty - why do you need the like operator in the first place? If your query always returns an example of a type MyModel , then you just need back to MyQuery; If your query contains MyModel's calculation (and this is what it looks like) and you just want to use it that you can use back to myQuery.FirstOrDefault (); Instead .
Comments
Post a Comment