nuget.server包_第七周NuGet软件包-带有SQL Server Compact的ELMAH(错误记录模块和处理程序)

nuget.server包

nuget.server包

Hey, have you implemented the NuGet Action Plan? Get on it, it'll take only 5 minutes: NuGet Action Plan - Upgrade to 1.3, Setup Automatic Updates, Get NuGet Package Explorer. NuGet 1.3 is out, so make sure you're set to automatically update!

嘿,您是否执行了NuGet行动计划 马上开始,只需5分钟: NuGet行动计划-升级到1.3,设置自动更新,获取NuGet软件包资源管理器 NuGet 1.3已发布,因此请确保您设置为自动更新!

The Backstory: I was thinking since the NuGet .NET package management site is starting to fill up that I should start looking for gems (no pun intended) in there. You know, really useful stuff that folks might otherwise not find. I'll look for mostly open source projects, ones I think are really useful. I'll look at how they built their NuGet packages, if there's anything interesting about the way the designed the out of the box experience (and anything they could do to make it better) as well as what the package itself does.

背景:自从NuGet .NET程序包管理站点开始填充以来,我一直在思考,我应该开始在其中查找gem(无双关语)。 您知道的,否则人们可能找不到真正有用的东西。 我会寻找大多数开源项目,这些项目我认为真的很有用。 我将看看他们如何构建他们的NuGet软件包,如果关于开箱即用体验的设计方式(以及他们可以做得更好的任何方式)以及软件包本身的功能有什么有趣的事情。

This week's Package of the Week is "ELMAH 1.2 with SQL Compact."

本周的软件包是“带有SQL Compact的ELMAH 1.2 ”。

You may already use ELMAH. Don't stop reading now, because you're going to need this information!

您可能已经在使用ELMAH。 现在不要停止阅读,因为您将需要此信息!

Now, I've been blogging and promoting ELMAH (Error Logging Modules and Handlers) for years. It's the first thing I add to any ASP.NET project of any importance. It's one of the great little gems of ASP.NET open source.

现在,我多年来一直在博客和推广ELMAH (错误记录模块和处理程序)。 这是我添加到任何重要的ASP.NET项目的第一件事。 它是ASP.NET开源的伟大小宝石之一。

I've shown "install-package elmah" in a number of talks and videos as my go-to demo for how NuGet and a well structured OSS package get you started quickly. Recently the ELMAH team has started to do some restructuring of their packages, and I wanted to showcase their work so you can not only learn from it, but also implement similar structures in your own packages.

我已经在许多讲座和视频中展示了“ install-package elmah”,这是我的入门演示,其中介绍了NuGet和结构良好的OSS软件包如何使您快速入门。 最近,ELMAH团队已开始对其软件包进行一些重组,我想展示他们的工作,以便您不仅可以从中学到东西,而且可以在自己的软件包中实现类似的结构。

First, spend a few minutes checking out how ELMAH works and how it can add to your ASP.NET project. Now, let's look at the (currently three, soon to be more) ELMAH packages that are up on NuGet.org.

首先,花几分钟检查ELMAH的工作方式以及如何将其添加到ASP.NET项目中。 现在,让我们看看(目前有三个,很快就被更多)ELMAH包是多达上NuGet.org

There's currently:

目前有:

  • ELMAH Core Library (no config) - "Core library for ELMAH (Error Logging Modules and Handlers) without any configuration"

    ELMAH核心库(无配置) -“没有任何配置的ELMAH(错误记录模块和处理程序)的核心库”

    • This one includes just the library. If you already have a custom ELMAH configuration or you want to create a new one, you can use and depend on this "core" package.

      这仅包括库。 如果您已经具有自定义的ELMAH配置,或者想要创建一个新的配置,则可以使用并依赖于此“核心”程序包。

    ELMAH Core Library (no config) - "Core library for ELMAH (Error Logging Modules and Handlers) without any configuration"

    ELMAH核心库(无配置) -“没有任何配置的ELMAH(错误记录模块和处理程序)的核心库”

  • ELMAH - "ELMAH with initial configuration for getting started quickly. ELMAH (Error Logging Modules and Handlers) is an application-wide error logging facility that is completely pluggable. It can be dynamically added to a running ASP.NET web application, or even all ASP.NET web applications on a machine, without any need for re-compilation or re-deployment."

    ELMAH- “具有用于快速入门的初始配置的ELMAH。ELMAH(错误记录模块和处理程序)是应用程序范围的错误记录工具,可以完全插入。可以动态地将其添加到正在运行的ASP.NET Web应用程序中,甚至所有一台机器上的ASP.NET Web应用程序,无需重新编译或重新部署。”

    • This one includes the basics you'll need to for a drop-in/just-works configuration. This isn't the "core" library, but rather one that depends on the core. It's the "getting started" one.

      这其中包括您需要进行即插即用配置的基础知识。 这不是“核心”库,而是取决于核心的库。 这是“入门”之一。

    ELMAH - "ELMAH with initial configuration for getting started quickly. ELMAH (Error Logging Modules and Handlers) is an application-wide error logging facility that is completely pluggable. It can be dynamically added to a running ASP.NET web application, or even all ASP.NET web applications on a machine, without any need for re-compilation or re-deployment."

    ELMAH- “具有用于快速入门的初始配置的ELMAH。ELMAH(错误记录模块和处理程序)是应用程序范围的错误记录工具,可以完全插入。可以动态地将其添加到正在运行的ASP.NET Web应用程序中,甚至所有一台机器上的ASP.NET Web应用程序,无需重新编译或重新部署。”

  • ELMAH on MS SQL Server Compact - "ELMAH with configuration for getting started quickly on a Microsoft SQL Server Compact database as the error log."

    MS SQL Server Compact上的ELMAH-“具有用于在Microsoft SQL Server Compact数据库上快速入门的配置的ELMAH作为错误日志。”

    • This package depends on the Elmah library and Elmah.CoreLibrary package as well as SqlServerCompact and adds configuration for using them together.

      该软件包取决于Elmah库和Elmah.CoreLibrary软件包以及SqlServerCompact,并添加了将它们一起使用的配置。
    • Dependency chain: elmah.sqlservercompact -> elmah -> elmah.corelibrary

      依赖链:elmah.sqlservercompact-> elmah-> elmah.corelibrary

    ELMAH on MS SQL Server Compact - "ELMAH with configuration for getting started quickly on a Microsoft SQL Server Compact database as the error log."

    MS SQL Server Compact上的ELMAH-“具有用于在Microsoft SQL Server Compact数据库上快速入门的配置的ELMAH作为错误日志。”

Here's the web.config.transform that elmah.sqlservercompact adds to your base ELMAH web.config:

这是elmah.sqlservercompact添加到基本ELMAH web.config中的web.config.transform:

<configuration>
<elmah>
<errorLogtype="Elmah.SqlServerCompactErrorLog, Elmah"connectionStringName="elmah-sqlservercompact"/>
</elmah>
<connectionStrings>
<addname="elmah-sqlservercompact"connectionString="Data Source=|DataDirectory|\Elmah.sdf"/>
</connectionStrings>
</configuration>
ELMAH Database Column Structure

Give it a try, it's easy, just install-package elmah.sqlservercompact. This basic package dependency structure will enable the Elmah guys to create "quick starts" with different configurations that each depend on elmah, which depends on the elmah.corelibrary. 

试试看,这很容易,只需安装软件包elmah.sqlservercompact。 这种基本的软件包依存关系结构将使Elmah家伙可以使用不同的配置创建“快速启动”,每个配置都取决于elmah,而后者取决于elmah.corelibrary。

ELMAH supports many formats for storing errors, but I think that SQL Server Compact is a great choice for small to medium size applications.

ELMAH支持多种格式来存储错误,但是我认为SQL Server Compact是中小型应用程序的绝佳选择。

  • Everything in one place and queryable.

    一切都集中在一处,可查询。
  • No mess of text files or XML files

    没有混乱的文本文件或XML文件
  • Database survives application restarts/recycles

    数据库在应用程序重新启动/回收后仍然存在

If you're using a WebFarm, you might want to use a central SQL Server instance, but I know a number of folks who run WebFarms and still prefer their errors on a per WebServer basis.

如果您使用的是WebFarm,则可能要使用中央SQL Server实例,但是我知道许多运行WebFarms的人仍然喜欢每个WebServer上的错误。

When your application starts up, ELMAH will put the Elmah.sdf in your ~\App_Data folder. The database is structured like this image at right. With the SQL Server Compact tooling that's added with Visual Studio 2010 SP1 you can open the SDF file right in VS and query it if you like.

当您的应用程序启动时,ELMAH会将Elmah.sdf放入〜\ App_Data文件夹中。 数据库的结构如右图所示。 使用Visual Studio 2010 SP1附带SQL Server Compact工具,您可以直接在VS中打开SDF文件,并根据需要查询它。

If you prefer a different backend for your logs, we should soon see NuGet "quick start" packages for many of the supported ELMAH storage solutions. You can even get your errors as RSS or JSON!

如果您希望日志使用不同的后端,我们很快就会看到许多支持的ELMAH存储解决方案的NuGet“快速启动”软件包。 您甚至可以通过RSS或JSON来获取错误!

Also, be aware that Elmah has just be updated to version 1.2 with a number of new features and fixes. ELMAH works in .NET 1.1 and .NET 2, so there's no excuse for not checking it out!

另外,请注意, Elmah刚刚被更新为1.2版,其中包含许多新功能和修复程序。 ELMAH在.NET 1.1和.NET 2中工作,因此没有借口不签出它!

Screenshot of an ELMAH log
()

Enjoy, and thanks to the ELMAH team for putting up with my nagging, bug reports and reviews over the last few months! It's only because I love the project so much!

尽情享受,并感谢ELMAH团队在过去的几个月中忍受了我的烦恼,错误报告和评论! 只是因为我非常喜欢这个项目!

相关链接 (Related Links)

翻译自: https://www.hanselman.com/blog/nuget-package-of-the-week-7-elmah-error-logging-modules-and-handlers-with-sql-server-compact

nuget.server包

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值