Mike
Mike

Reputation: 4287

Tips on creating a reusable library

I recently started transforming all tables from our Oracle production into models so I can start using an ORM. I chose Castle Active Record and can really start to see its potential in making my life easier. Since many of the applications I work with utilize the same tables. I figure it would be nice to create a separate library.

My thinking is that if I can successfully separate the database work, table relationships and querying then I can reuse them to my hearts content from project to project. I know for the most part how to create new entities, link them and query what I need based on what is mapped. As of now I have a very simple class library. I could then include generic functions that could be used to query a lookup table and return an id-value pair to populate a dropdown, for example.

Could you please give me some tips and/or personal experiences to achieve this? This will be my first time attempting to create a reusable library of any sort.

Thank you.

Upvotes: 1

Views: 381

Answers (3)

Chad
Chad

Reputation: 3227

I would:

  • Keep it simple.
  • Document its public interfaces/methods heavily, especially since you'll use it in multiple projects.
  • Keep it in source control, which you should be doing anyways, so all projects can easily get updates.

Upvotes: 2

Robert Seder
Robert Seder

Reputation: 1420

This is an ideal place to use interfaces. Store all of your interfaces in a very small, isolated .dll - and you can distribute that. Your consumers can then deal with their own implementations (if I'm understanding you correctly). You could also deploy a standalone component that just has your data structures too.

Upvotes: 1

Chris
Chris

Reputation: 40643

WCF is a popular way to achieve this. Basically you make a bunch of WCF web services that provide access to the data access functions.

Upvotes: 1

Related Questions