百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
P

PeanutButter

> 数据库
开源

美味、多用途、营养丰富;与 .net 中的许多内容搭配得很好。

188 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

美味、多用途、营养丰富;与 .net 中的许多内容搭配得很好。

PeanutButter

Download stats

Go to documentation

"Some tastiness to add to your dev sandwich"

PeanutButter is a collection of projects which provide useful bits of functionality that I've often had to re-use (and also provides some concrete examples of usage). Sometimes I can even be bothered to write about it at http://davydm.blogspot.co.za/search/label/PeanutButter.

Inside, you'll find, amongst other things:

  • Duck-typing for .NET (PeanutButter.DuckTyping)
    • rigid or fuzzy duck-typing, including the ability to wrap a dictionary with a strongly-typed interface, even if the starting dictionary is empty.
  • Randomisation utilities for testing with (PeanutButter.RandomGenerators)
    • Random Value Generators
      • Tests with random values are usually more useful because, if nothing else, after many runs, you've hit many test scenarios and often an edge case which would cause you production headaches pops out of the wood work. I prefer to test with random values wherever possible
      • In addition to the helpers in RandomValueGen which can be used to get randomised:
        • string values (arbitrary, alphabetic, or alphanumeric)
        • numeric values (decimal, long)
        • boolean values
        • datetime values there is also the GenericBuilder base which you can use as a very quick and easy way to create builders for complex types. These builders have the ability to generate randomised or directed objects.
  • Test utilities:
    • PeanutButter.TestUtils.Generic which allows easy TestCase scenarios for property get/set tests with PropertyAssert which allows easy comparison of properties by name or, indeed relative path from the objects provided
    • PeanutButter.TestUtils.MVC (sunset) which provides a JsonResultExtensions class to simplify testing MVC actions which return JsonResults
    • PeanutButter.MVC (sunset), which provides facades and interfaces to make script and style bundles testable
    • PeanutButter.TestUtils.Entity provides mechanisms for testing your EF-based project code against temporary databases so you can be sure that the code you deploy will work as expected. This library is supported by PeanutButter.TempDb, so you can test (out of the box) against LocalDb, Sqlite and SQLCE. You can also provide your own TempDb<> implmentation
  • Arbitrary utils
    • DecimalDecorator which provides relatively safe string/decimal interchange, irrespective of culture
    • XElementExtensions to make dealing with XElement text easier
  • On-the-fly HTTP server for testing when you simply need a WebRequest to work
  • TempDb implementations (LocalDb, SqlCe and Sqlite) so you can run tests which involve migrations and integration between your ORM and the actual db
  • WindowsServiceManagement
    • provides functionality for query of & interaction with win32 services using the native Win32 api, exposed in an easy-to-use C# POCO
  • PeanutButter.DatabaseHelpers
    • provides builders for Select, Update, Delete and Insert SQL statements for legacy projects where you can't (at least, not yet) get in an ORM. The builders are more testable and you can use compile-time constants for table/column names to help to harden your code against dev errors and code rot
    • provides OleDB database executors and a data reader builder
  • PeanutButter.ServiceShell
    • provides scaffolding for a polling win32 service: inherit from the ServiceShell class, configure name and interval and provide your custom logic in the RunOnce override
    • resultant services can install and uninstall themselves as well as be invoked for once-off runs from the commandline. The project also contains a simple, but effective log4net configuration for console and a log file
  • EmailSpooler.Win32Service
    • harnesses PeanutButter.ServiceShell to provide a generic SMTP email spooling service backed with a data store. You can (theoretically) use any database which Entity can connect to, though this project has only been tested against MSSQL
    • EmailSpooler.Win32Service.DB provides FluentMigrator and raw SQL script files for generating the required underlying data structures.

Barring the last item, none of these are stand-alone: they're all just building blocks which I've had to repeat and refine, so I figure they may be of use to others. As far as possible, the code should be under test, though some projects are more difficult to unit test (eg the PeanutButter.WindowsServiceManagement project, which was developed TDD-style but which would sometimes flake out on tests because the windows service management would be hit too hard or often. But it does work (:) And some are libraries to help with testing, so you'll soon find that they work as expected.

A shout out to:

The work on PeanutButter would have been a lot more effort without Rider from JetBrains. The good people at JetBrains have provided free licensing for all of their products for open-source projects like this one. To learn more about JetBrains products, please visit them

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#csharpduck-typinghacktoberfestmysql

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类数据库
定价开源

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库