当前位置: 动力学知识库 > 问答 > 编程问答 >

.net - C# Library for a collection with many-to-many associations between items? (e.g. one node table & one relationship table)

问题描述:

Is anyone aware of a C# library that provide a means to manage a Web like map of items, which each item can have relationships to other items in the collection/table. As an example an implementation of this with a datastore might see the schema looking like the below. Picture a page with node objects scattered across it with lines going between them in a non-hierachal sense, with the lines have one arrow head (implying the parent-child relationship). So a node can have multiple parents, and multiple children.

> Table: Nodes

> - ID

> - Description

> - etc

>

> Table: Relationships

> - ParentNodeID

> - ChildNodeID

The library would have API methods such as:

  • AddParent(parent)
  • AddChild(child, parent)
  • GetChildren(item)
  • GetRootParent(item)
  • Delete(item)
  • etc

As an example of the complexity, the "Delete(item)" method would need to "walk the tree" so to speak and have the smarts to know which nodes it can delete depending on whether that node itself actually has another parent item somewhere which it references.

Ideally the library would support ADO.net for persisting it to database (in fact I'm using SQLite).

Anyone come across such a library?

Thanks

网友答案:

http://sqlite.phxsoftware.com/

  • Complete ADO.NET 2.0 Implementation
  • Support for the ADO.NET 3.5 Entity
  • Framework Visual Studio 2005/2008 Design-Time Support

Edit: I am using this for a while no issues at all.

分享给朋友:
您可能感兴趣的文章:
随机阅读: