How to keep data in Object - c#-4.0

I have a table or tables in sqlServer. I want to take data from database and keep this table's data into objects like class, but I dont want to keep this data into dataset.
What are those ways to keep data into objects taking data from database?
How can I pass data into object but not in dataset or datatable?

ORM is what you should be looking for.
For .Net framework you can look into
Entity Framework
LINQ to SQL
NHibernate
Dapper

ORM is the solution as mentioned above.....
Better use entity frame work that is good for this purpose.......it will creates entity classes with all your tables in the database.

In short: as it is suggested in the comment, some type of ORM (Object relational mapping) will do that magic for you.
Good references on this topic are the followings:
4 Benefits of Object-Relational Mapping (ORM)
ORM mapping data to objects
DataObjects.Net - ORM Framework for RAD - Introduction
Edit: To choose the right ORM for your problem, look at this Wikipedia article
List of object-relational mapping software.

Related

OOAD and Cassandra. How?

I am trying to wrap my head around doing object oriented analysis and design when your canonical data source is Cassandra.
Specifically:
How do I maintain data consistency if data is duplicated among the denormalized cassandra tables?
How do I maintain a clean object design? Do I have to have a reference diagram that shows how my domain models map to the denormalized tables?
Thanks.
Essentially, the same way you would if you used a RDBMS as the data-store. Create OO domain-model classes. Access the data-store through an abstract interface, the persistence layer, which accepts and provides objects of those classes. Internally, have the persistence layer convert to and from your domain-model classes and Cassandra tables.

Whats the difference between ORM and ORP?

What is the difference between Object Relational Mapping(ORM) and Object Relational Persistence(ORP)?
From what i know ORM is a framework for mapping relational tables to application domain objects and relationships between them. So in ORM you would already have a Persistent data structure?
ORP consists of:
Entities
Database connection
Database
Mapping (ORM)
Etc..
We could almost say it is the same thing since ORM is a term which is used as ORP. Both are used to indicate the same thing.

Creating a glue table with Core Data?

Let's say I had one entity called "Garage" and one entity called "Cars".
In SQL I might create a third table (sometimes called a glue table) that would just have two fields "GarageID" "CarID"
That way I could relate certain cars to certain garages.
How would this be handled with the Core Data modeller?
Thanks!
You are talking about many-to-many relations. CoreData supports such model. Just create in both entities relations to each other set as "to-many". That's all.

Complex Type in Subsonic 3

I am going to use subsonic 3 in a large enterprise winform application.
what i saw in my personal tests is that subsonic cannot handle complex type references well.
for example if we have an ADDRESS complex type in PERSON object , as far as i saw subsonic just created the PERSON table and is not caring about the Address property of it !
i was wondering how can i solve it ?
Secondly, we have inheritance in our objects, how subsonic can handle it with table-per-subclass strategy?
SubSonic isn't well suited to these scenarios. Regarding complex types you could write a service/repository to handle saving and building these types, but there's no pre-existing way of mapping this to the database.
The same goes for inheritance schemes.
You might want to look at more full-featured O/RM like NHibernate or EF.

Subsonic table mappings

I've searched a lot and I haven't really found an answer.
Is it possible to use POCOs with Subsonic?
How do I map tables (which do not look like the POCOs) to my classes?
SubSonic doesn't provide a built in way to map tables to your POCOs.
The closest it would come would be using the ActiveRecord portion of SubSonic which would generate one class per table (with properties for each table column and foreign key relationship to other tables).
Depending on how your POCOs look, you might be able to get data easily (or not) between the generated ActiveRecord classes and your POCOs. Also, the generated ActiveRecord classes are created via templates which you can modify to fit your needs.

Resources