ASP.Net用户活动追踪数据库 [英] ASP.Net User activity tracking in database

查看:234
本文介绍了ASP.Net用户活动追踪数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是关于我想与我现有的ASP.Net基于Web的应用程序内集成了一个简单而有效的活动日志框架(我有一个LINQ到SQL基于SQL数据库作为后端)。我使用的是像一个服务架构来执行数据库操作 - 即调用相关的LINQ操作。我有一个服务类的几乎每一个实体(如数据库表),并处理CRUD操作。

  

在一般情况下,我需要跟踪的活动   像 - X先生增加了一个新的项目,My.Y   搜索关于该过滤器,Mr.Z出口   网格到Excel的结果   文档等..和类似的简单   基于操作日志(字段级   日志记录是远远现在)

所以,这是我在研究及发展我的2天发现; D对的,因此,其他论坛和网站:

方法一: 使用两个表的简单的老办法:活动(存储所有的活动,连同其男主角)及ActivityType(列出类型的活动)。我有一个服务层,要么我可以有一个ServieBase类,水龙头所有的CRUD事件,并记录在其中我很感兴趣。一切都从内部code处理。

  

例:    http://dotnetslackers.com/articles/aspnet/Tracking-User-Activity.aspx

方法2: 使用数据库触发器挖掘在表级别事件,然后进行记录。这将是完全抽象的应用程序。我在每个表LastModifiedBy字段,所以我会得到'演员'的数据,我可以做的记录,但这个可能会限制我的DB-运营和放大器;需要我分别跟踪等应用程序,活动。但如果它的价值,我可以考虑一下。

方法3:(概念,需要更多的指导)

3.1 MVC方法 - 我们正在考虑采用MVC的未来,我已经找到了一些有效的记录板斧MVC一样 - (是这样的疗法什么传统L2S基于Web的应用程序吗? )

在ASP.NET MVC应用程序

记录用户活动 <一href="http://stackoverflow.com/questions/1514616/track-user-activity-actions-for-an-asp-net-mvc-website">Track用户活动/为一个asp.net mvc的网站行动?

3.2跟踪服务我在windows碰到一个跟踪服务功能 - ?是否有其网站当量

  

http://msdn.microsoft.com/en-us/magazine/ cc163466.aspx    HTTP://www.$c$cproject.com/KB /WF/WWF__Tracking_Service.aspx?msg=2879654

3.3其它 - 我遇到了,但似乎并没有太多说服力或我最好说,他们做他们的工作,但不是我的其他一些选项: - )

参考 -

http://learn.iis.net /page.aspx/480/sample-web-analytics-tracking-module/

  

SQL事件探查器:   <一href="https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-5054787.html" rel="nofollow">https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-5054787.html    http://technet.microsoft.com/en-us/library/cc966515.aspx

那么,还有什么好说的?任何建议和新的思想是值得欢迎的。现在,看来我的第一两种方法之间的某处土地,因为我们希望它是很容易在未来可以添加任何额外的活动进行记录。

感谢你。

解决方案

我结束了前两种方法中使用,因为他们似乎更简单,更容易

。最重要的是,他们提供了更多的控制权,并允许保留的东西一样灵活的要求(即其接近实际后端编码,这使得它更容易)

我将其标记为一直没有其他的广泛评论。

感谢你。

This is about a simple yet efficient activity logging framework that I want to integrate with my existing ASP.Net based web-app (I've a LINQ-to-SQL based SQL DB as backend). I'm using something like a service-architecture to perform DB operations - that is invoke relevant LINQ operations. I've a service class for almost every entity (i.e. DB table) and it handles the CRUD operations.

In general, I need to track activities like - Mr.X added a new Item, My.Y searched on this filter, Mr.Z exported the result of Grid to an excel document, etc... and similar simple operation based logging (field-level logging is far for now)

So, here's what I've found in my two days of R&D on the SO, other forums and the web:

Approach 1: Simple old way of using two tables: Activity (stores ALL the activities along with its actor) & ActivityType (lists types of activities). I've a service layer so either I can have a "ServieBase" class which taps ALL the CRUD events and logs the one in which I'm interested. Everything is handled from within the code.

Example: http://dotnetslackers.com/articles/aspnet/Tracking-User-Activity.aspx

Approach 2: Use database TRIGGERs to tap events at table level and then perform logging. This will be completely 'abstract' to the app. I've "LastModifiedBy" field in each table so I'll get the 'actor' data and I can do the logging but this might limit me to DB-operations & need me to track other app-activities separately. but if its worth I can consider it.

Approach 3: (conceptual, need more guidance)

3.1 MVC approach - We're thinking of adopting MVC in future and I've found some efficient logging tricks in MVC like - (is ther anything like that for traditional L2S based web-app?)

Log User Activity on ASP.NET MVC Application Track user activity/actions for an asp.net mvc website?

3.2 Tracking Services I came across a 'tracking service' feature in windows - is there its web-equivalent?

http://msdn.microsoft.com/en-us/magazine/cc163466.aspx http://www.codeproject.com/KB/WF/WWF__Tracking_Service.aspx?msg=2879654

3.3 Misc - Some other options which I came across but don't seem too convincing or I'd better say they do their work but not mine :-)

Ref -

http://learn.iis.net/page.aspx/480/sample-web-analytics-tracking-module/

SQL Profiler: https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-5054787.html http://technet.microsoft.com/en-us/library/cc966515.aspx

So, what say? Any suggestions and new thoughts are welcome. For now, it seems I'd land somewhere between the first-two approaches because we want it to be easy in future to be able to add any extra activity to be logged.

Thank you.

解决方案

I ended up using among the first two approaches because they seem more simple and easier. Most of all they provide more control and allow to keep thing as flexible as required (i.e. its near to the actual backend coding which makes it more accessible)

I'm marking it as there has been no other extensive reviews.

Thank you.

这篇关于ASP.Net用户活动追踪数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆