问题
When implementing a custom membership provider I see that the underlying data model has ISONLINE column in the USER table, as described here: http://msdn.microsoft.com/en-us/library/6tc47t75.aspx
Question: When is this field actually updated in the database? In the sample implementation MSDN gave, there is no updating of this column, and IsOnline property is calculated as:
return (now - userIsOnlineTimeWindow > LastActivityDateTime ? false:true);
So what is the purpose of ISONLINE column in the USER table if it's never updated??? Or I am missing out on something???
Thanks
回答1:
I also realised this and assumed it was an idea that was never implemented.
Since you have LastActivityDateTime, you can always check that.
回答2:
I seem to remember noticing the same, and concluding that it's probably a 'left-over', ie. not used.
The implementation you quote does the trick well enough, so long as the LastActivityDateTime
is updated when appropriate. I guess they just forgot to update the schema.
来源:https://stackoverflow.com/questions/1288248/asp-net-custom-membership-provider-isonline-property