如何将关系数据导入对象? [英] How to get relational data into an object?
问题描述
是否存在将关系数据从
数据库和对象中获取的模式或最佳实践?
有问题的对象具有公共属性看起来像这样:
_stringName
cfgObjects的_ArrayList
_DateTime
_Integer
cfgObject如下所示:
_stringCfgName
_ArrayList1 of strings
_ArrayList2 of strings
_bool1
_bool2
初始化这些对象的数据存储在带有
$ b $的类型化数据集中b约束和关系。
我想我可以填充一个DataTable并在
对象的构造函数中迭代它但是,作为C#的新手,我的猜测是那里有一些
模式或练习,甚至是FCL中的一些课程,它们有更好的方式。
是否有标准(或更好)的方法从关系数据中获取对象?
提前致谢。
Is there a Pattern or best Practice for getting relational data out of a
database and into an object?
The object in question has public properties that look like this:
_stringName
_ArrayList of cfgObjects
_DateTime
_Integer
the cfgObject looks like this:
_stringCfgName
_ArrayList1 of strings
_ArrayList2 of strings
_bool1
_bool2
The data that initializes these objects is stored in a typed DataSet with
constraints and relations.
I suppose I could populate a DataTable and iterate through it in the
object''s constructor but, as a newbie to C#, my guess is there''s some
pattern or practice out there, or even some class in the FCL, that has a
better way.
Is there a standard (or better) way to get an object from relational data?
Thanks in advance.
推荐答案
Google for C#ORM或OR / M - 对象关系映射,和实体对象,
等。
有很多要涵盖的内容!如果确定有人会用他们最喜欢的
方法和产品插入...
m
" deko" <德** @ nospam.com>在消息中写道
新闻:AN ****************************** @ comcast.com。 ..
Google for C# ORM or OR/M - object-relational mapping, and "entity objects",
and the like.
There''s a lot to cover! If sure people will chime in with their favorite
methods and products...
m
"deko" <de**@nospam.com> wrote in message
news:AN******************************@comcast.com. ..
是否存在将关系数据从
数据库和对象中获取的模式或最佳实践?
有问题的对象具有公共属性看起来像这样:
_stringName
_ArrayList of cfgObjects
_DateTime
_Integer
cfgObject如下所示:
_stringCfgName
_ArrayList1 of strings
_ArrayList2 of strings
_bool1
_bool2
初始化这些对象的数据存储在带有
我想我可以填充一个DataTable并在
对象的构造函数中迭代它,但是,作为C#的新手,我的猜测是''在那里有一些模式或练习,甚至是FCL中的一些课程,它们有更好的方法。
是否有标准(或更好)的方法来获得来自关系数据的对象?
Tha提前nks。
Is there a Pattern or best Practice for getting relational data out of a
database and into an object?
The object in question has public properties that look like this:
_stringName
_ArrayList of cfgObjects
_DateTime
_Integer
the cfgObject looks like this:
_stringCfgName
_ArrayList1 of strings
_ArrayList2 of strings
_bool1
_bool2
The data that initializes these objects is stored in a typed DataSet with
constraints and relations.
I suppose I could populate a DataTable and iterate through it in the
object''s constructor but, as a newbie to C#, my guess is there''s some
pattern or practice out there, or even some class in the FCL, that has a
better way.
Is there a standard (or better) way to get an object from relational data?
Thanks in advance.
你好deko,
只是为了添加到Mike post abt O / R mapping I建议使用NHibernate和
CodeSmith与第三方模板
请参阅构建DAL的示例在那边 http://community.codesmithtools.com/.../nettiers.aspx
d>是否有获得关系数据的模式或最佳实践
d>数据库和对象?
d>
d>有问题的对象具有如下公共属性:
d>
d> _stringName
d> _ArrayList of cfgObjects
d> _DateTime
d> _Integer
d> cfgObject如下所示:
d>
d> _stringCfgName
d> _ArrayList1 of strings
d> _ArrayList2 of strings
d> _bool1
d> _bool2
d>初始化这些对象的数据存储在类型化的数据集中
d>有约束和关系。
d>
d>我想我可以填充一个DataTable并在
d>中迭代它。对象的构造函数,但作为C#的新手,我的猜测是有一些
d>那里的模式或练习,甚至整箱的一些课程,
d>有一个更好的方法。
d>
d>是否有标准(或更好)的方式从关系中获取对象
d>数据?
d>
d>在此先感谢。
d>
---
WBR,
Michael Nemtsev ::博客:< a rel =nofollowhref =http://spaces.msn.com/laflourtarget =_ blank> http://spaces.msn.com/laflour
有时一个人仍然忠实于一个事业,只因为它的对手没有,b $ b不再是平淡无奇的。 (c)Friedrich Nietzsche
Hello deko,
Just to add to Mike post abt O/R mapping I recomend to use NHibernate and
CodeSmith with 3rd-party templates
See Example of building DAL is over there http://community.codesmithtools.com/.../nettiers.aspx
d> Is there a Pattern or best Practice for getting relational data out
d> of a database and into an object?
d>
d> The object in question has public properties that look like this:
d>
d> _stringName
d> _ArrayList of cfgObjects
d> _DateTime
d> _Integer
d> the cfgObject looks like this:
d>
d> _stringCfgName
d> _ArrayList1 of strings
d> _ArrayList2 of strings
d> _bool1
d> _bool2
d> The data that initializes these objects is stored in a typed DataSet
d> with constraints and relations.
d>
d> I suppose I could populate a DataTable and iterate through it in the
d> object''s constructor but, as a newbie to C#, my guess is there''s some
d> pattern or practice out there, or even some class in the FCL, that
d> has a better way.
d>
d> Is there a standard (or better) way to get an object from relational
d> data?
d>
d> Thanks in advance.
d>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
>只是添加到Mike post abt O / R映射我建议使用NHibernate和
> Just to add to Mike post abt O/R mapping I recomend to use NHibernate and
CodeSmith与第三方模板
请参阅构建DAL的示例在那边
http://community.codesmithtools.com/。 ../nettiers.aspx
CodeSmith with 3rd-party templates
See Example of building DAL is over there
http://community.codesmithtools.com/.../nettiers.aspx
CodeSmith听起来很棒(它应该是100美元)。我会试用
版本旋转。
感谢您的提示。
CodeSmith sounds great (it ought to be for 100 bucks). I''ll take the trial
version for a spin.
Thanks for the tip.
这篇关于如何将关系数据导入对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!