B
bumperman_jc
Hi,
I am new to .net. I think .NET provides what I need, but I don't
know how to implement it.
What I need is simply associating an object with a database
table. I would like to load "objects" from table, and I would like to
modify or delete objects, without dealing with database in anywhere. In
other words; I do not want to write SQL query for any of those
operations. Let me give you an example (in C++/CLI):
ref class MessageBase abstract
{
String^ m_strFrom;
String^ m_strBody;
String^ m_strSubject;
DateTime m_dtRecSent;
DateTime m_dtReplied;
DateTime m_dtForwarded;
MessageTypes m_mtType;
public:
property String^ From { String^ get(); void set(String^); }
property String^ Body { String^ get(); void set(String^); }
property String^ Subject { String^ get(); void set(String^); }
property DateTime ReceivedDate { DateTime get(); void
set(DateTime); }
property DateTime RepliedDate { DateTime get(); void
set(DateTime); }
property DateTime Forwarded { DateTime get(); void set(DateTime);
}
property DateTime SentDate { DateTime get(); void set(DateTime); }
property MessageTypes MessageType { MessageType get(); void
set(MessageTypes); }
};
I have got a table to store this information. I would like to
load "messages" from table at startup, through a factory (another
recommendation?). I have prepared a typed dataset, too, but I couldn't
associate it with this class. What I have done previously in C++ was a
simple adapter. Adapter was acting like a "message object" to the
application itself, any changes in the object automatically goes
database, too. As far as I have heard, after associating this class
with a table, I will not write any SQL statement.
I would be very happy, if you could enlighten me about this type
of association. I am using .NET Framework 2.0 (of course, since I am
using C++/CLI) and I do not have a performance concern with this
operation (I have heard that this type of association of an object with
a dataset is far slower than SqlDataReader way). Database is SQLite, I
am using ADO.NET class library to access database from .NET (I have
native library as well).
Thanks!
Jason
I am new to .net. I think .NET provides what I need, but I don't
know how to implement it.
What I need is simply associating an object with a database
table. I would like to load "objects" from table, and I would like to
modify or delete objects, without dealing with database in anywhere. In
other words; I do not want to write SQL query for any of those
operations. Let me give you an example (in C++/CLI):
ref class MessageBase abstract
{
String^ m_strFrom;
String^ m_strBody;
String^ m_strSubject;
DateTime m_dtRecSent;
DateTime m_dtReplied;
DateTime m_dtForwarded;
MessageTypes m_mtType;
public:
property String^ From { String^ get(); void set(String^); }
property String^ Body { String^ get(); void set(String^); }
property String^ Subject { String^ get(); void set(String^); }
property DateTime ReceivedDate { DateTime get(); void
set(DateTime); }
property DateTime RepliedDate { DateTime get(); void
set(DateTime); }
property DateTime Forwarded { DateTime get(); void set(DateTime);
}
property DateTime SentDate { DateTime get(); void set(DateTime); }
property MessageTypes MessageType { MessageType get(); void
set(MessageTypes); }
};
I have got a table to store this information. I would like to
load "messages" from table at startup, through a factory (another
recommendation?). I have prepared a typed dataset, too, but I couldn't
associate it with this class. What I have done previously in C++ was a
simple adapter. Adapter was acting like a "message object" to the
application itself, any changes in the object automatically goes
database, too. As far as I have heard, after associating this class
with a table, I will not write any SQL statement.
I would be very happy, if you could enlighten me about this type
of association. I am using .NET Framework 2.0 (of course, since I am
using C++/CLI) and I do not have a performance concern with this
operation (I have heard that this type of association of an object with
a dataset is far slower than SqlDataReader way). Database is SQLite, I
am using ADO.NET class library to access database from .NET (I have
native library as well).
Thanks!
Jason