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

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

问题描述

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

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.


一般来说,我需要跟踪活动
like - Mr.X添加了一个新项目,My.Y
在此过滤器上搜索,Z先生导出
Grid的结果到excel
文档等...和类似的简单
基于操作的日志记录(字段级别
日志是现在远)

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)

所以,这是我在我的两天的R& D在SO,其他论坛和网络发现:

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

方法1:
简单的使用两个表的旧方法:Activity(存储所有的活动以及它的actor)& ActivityType(列出活动的类型)。我有一个服务层,所以我可以有一个ServieBase类,它敲击所有的CRUD事件,并记录我感兴趣的一个。一切都在代码内处理。

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.


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

方法2:
使用数据库TRIGGER在表级轻击事件,然后执行日志记录。这将是完全抽象的的应用程序。我在每个表中的LastModifiedBy字段,所以我会得到'actor'数据,我可以做日志记录,但这可能限制我的DB操作&需要我分别跟踪其他应用活动。

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.

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

Approach 3: (conceptual, need more guidance)

3.1 MVC方法 - 我们正在考虑在将来采用MVC,我发现了一些有效的记录技巧在MVC中 - (是传统的基于L2S的web -app?)

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?)

在ASP.NET MVC应用程序上记录用户活动
跟踪asp.net mvc网站的用户活动/操作

3.2跟踪服务我在Windows中遇到了一个跟踪服务功能 - 是否有与网页等效的功能?

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其他似乎不太有说服力,或者我最好说他们做他们的工作,但不是我的: - )

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 :-)

参考 -

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.

谢谢。

推荐答案

我最后使用前两种方法,因为它们看起来更简单和更容易。最重要的是,他们提供更多的控制,允许保持事情的灵活性所需(例如,它接近实际的后端编码,这使它更容易访问)

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.

谢谢。

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

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