asp.net custom membership provider: IsOnline property

社会主义新天地 提交于 2020-01-05 03:28:30

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!