人们想要一个持久的.NET词典中的什么?

问题描述 投票:7回答:2

我正在基于ESENT数据库引擎(使用ManagedEsent互操作层)实现通用的持久化.NET集合。到目前为止,我一直专注于完全模仿其System.Collections.Generic对应类的类,不同之处在于它们在构造函数中采用了指示数据库应该到达的位置的路径。像这样的代码正在工作:

using Microsoft.Isam.Esent.Collections.Generic;

static void Main(string[] args)
{
    var dictionary = new PersistentDictionary<string, string>("Names");
    Console.WriteLine("What is your first name?");
    string firstName = Console.ReadLine();
    if (dictionary.ContainsKey(firstName))
    {
        Console.WriteLine("Welcome back {0} {1}", firstName, dictionary[firstName]);
    }
    else
    {
        Console.WriteLine("I don't know you, {0}. What is your last name?", firstName);
        dictionary[firstName] = Console.ReadLine();
    }
}

我的问题是:

  • 除了与Stack,Queue和Dictionary兼容之外,人们希望/需要持久性集合中的哪些功能?
  • 我需要.NET框架的2.0版还是3.5版?
  • 键和值类型都限于基本的.NET类型(布尔,字节,[所有整数],浮点,双精度,Guid,DateTime和字符串)。我可能会添加对可序列化结构的值的支持。这种类型的限制是否太痛苦了?
  • 人们希望看到什么样的性能基准?
  • 人们希望将PersistedDictionary用于哪种应用程序?

下周我将准备好第一个版本,但我想确保自己构建的是正确的东西。

c# .net database dictionary persistence
2个回答
5
投票

我已经在Codeplex上发布了PersistentDictionary。这仅支持序列化结构,但我将使用支持存储和检索任意对象的不同数据结构。

https://github.com/microsoft/managedesent


3
投票

键上的类型限制可能是可接受的,但是在值上,我希望[Serializable]起作用。否则,有什么意义呢?像Dictionary<int, string>这样的简单案例,在教科书中的出现比在现实世界中要多得多。

© www.soinside.com 2019 - 2024. All rights reserved.