从类模型映射到关系模型.docx

从类模型映射到关系模型.docx

ID:57642567

大小:83.35 KB

页数:12页

时间:2020-08-29

从类模型映射到关系模型.docx_第1页
从类模型映射到关系模型.docx_第2页
从类模型映射到关系模型.docx_第3页
从类模型映射到关系模型.docx_第4页
从类模型映射到关系模型.docx_第5页
资源描述:

《从类模型映射到关系模型.docx》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、根据领域模型分析数据模型MappingfromtheClassModeltotheRelationalModel从类模型映射到关系模型Havingdescribedthetwodomainsofinterestandthenotationtobeused,wecannowturnourattentionastohowtomaportranslatefromonedomaintotheother.Thestrategyandsequencepresentedbelowismeanttobesuggestiveratherthanpro

2、scriptive-adaptthestepsandprocedurestoyourpersonalrequirementsandenvironment.在需要对两个领域建模时,现在我们可以关注如何从一个领域映射或转换映射到另一个领域。以下的策略和方法,就是要启发,而不是强制的步骤和程序应用到您的个人需求和环境。1.ModelClassesFirstlywewillassumeweareengineeringanewrelationaldatabaseschemafromaclassmodelwehavecreated.Thisis

3、obviouslytheeasiestdirectionasthemodelsremainunderourcontrolandwecanoptimisetherelationaldatamodeltotheclassmodel.Intherealworlditmaybethatyouneedtolayeraclassmodelontopofalegacydatamodel-amoredifficultsituationandonethatpresentsitsownchallenges.Forthecurrentdiscussion

4、willfocusonthefirstsituation.Ataminimum,yourclassmodelshouldcaptureassociations,inheritanceandaggregationbetweenelements.1.类建模首先,我们将假设从已创建的类模型生成一个新的关系数据库模型。这显然是最容易的,可控制的,可以通过关系数据库模型反向优化类模型。在现实世界中可能你需要将类模型作为数据模型的上层,这是更困难的情况,也对自己提出了一个挑战。对于目前的讨论将集中在第一种情况。至少,你的类模型应捕元素之间的联系

5、、继承和聚集关系。2.IdentifypersistentobjectsHavingbuiltourclassmodelweneedtoseparateitintothoseelementsthatrequirepersistenceandthosethatdonot.Forexample,ifwehavedesignedourapplicationusingtheModel-View-Controllerdesignpattern,thenonlyclassesinthemodelsectionwouldrequirepersis

6、tentstate.2.确认持久对象已建成的类模型,我们需要区分这些元素,那些需要持久化和那些不是。例如,如果我们设计我们的应用程序使用Model-View-Controller设计模式,那么只有MODEL模型部分需要持久化状态。3.AssumeeachpersistentclassmapstoonerelationaltableAfairlybigassumption,butonethatworksinmostcases(leavingtheinheritanceissueasideforthemoment).Inthesimpl

7、estmodelaclassfromthelogicalmodelmapstoarelationaltable,eitherinwholeorinpart.Thelogicalextensionofthisisthatasingleobject(orinstanceofaclass)mapstoasingletablerow.3.假设一个持久化类映射一个关系表大多数情况下,这都是一个合理的假设,除去继承问题以外(暂且不考虑)。在最简单的模型中,逻辑模型中的一个类映射一个关系表的全部或一部分。这种逻辑的延伸是一个单一的对象(或类的实例

8、)映射关系表中的一行数据。4.Selectaninheritancestrategy.Inheritanceisperhapsthemostproblematicrelationshipandlogicalconstructfromt

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。