Database/Object Mapping
Posted
by
Eric
on Stack Overflow
See other posts from Stack Overflow
or by Eric
Published on 2010-12-22T18:32:29Z
Indexed on
2010/12/23
21:55 UTC
Read the original article
Hit count: 191
Hello everyone,
This is a beginner question, but it's been frustrating me... I am using C#, by the way.
I'd like to make a few classes, each with their own properties and methods. I would also like to have a database to store certain instances of these classes in case I would ever need to look at them again. So, for example...
class Polygon
{
String name;
Double perimiter;
int numSides;
public Double GetArea()
{
// ...
}
}
class Circle
{
String name;
Double radius;
public void PrintName()
{
// ...
}
}
Say I've got these classes. I also want a database that has the TABLES "Polygon" and "Circle" with the COLUMNS "name" "perimeter" "radius" etc. And I want an easy way to save a class instance into the database, or pull a class instance out of the database.
I have previously been using MS Access for my database stuff, which I don't mind using, but I would prefer if nothing other than .NET need to be installed.
I've been researching online a bit, but I wanted to get some opinions on here. I have looked at Linq-to-Sql, but it seems you need Sql-Server. Is this true? If so, I'd really rather not use it because I don't want to have to have it installed everywhere.
Anway, I'm just fishing for some ideas/insights/suggestions/etc. so please help me out if you can.
Thanks.
© Stack Overflow or respective owner