这是场景,我正在使用 csla 3.8 / c#.net 开发一个应用程序,该应用程序将具有不同的模块。它就像一个ERP,会有会计、日常记录、招聘等模块。
现在的要求是检查每个模块的公共实体并从中构建一个“平台”(<-老板这样称呼它)。例如,DTR 将有一个实体“员工”,招聘将有“申请人”,因此您可以从两者派生并放入平台的一个常见实体是“人员”。 “Person”将包含典型信息,如姓名、地址、联系信息等。
我知道这听起来像 OOP 101。问题是,我不知道该怎么做。我多么希望这只是一个简单的继承,但要求就像创建某种 API 供使用 CSLA 的模块使用。
在 csla 中,您可以正确地创建智能对象,继承自 csla 的基类,如businessListbase、readonlylistbase 等,对吗?例如,如果我创建了一个业务基础申请人类,它将具有薪资需求、可用日期等属性,现在对于个人信息,我将需要“平台”中的“人”并将其实施到申请人类。
总而言之,我有几个问题:
- 如何创建这样的平台?
- 如果这样的平台是可能的,它将如何在每个模块的实体上实现? (我已经从csla的基类继承)
- 如果情况1和2是可能的,它对应用程序的开发和维护有优势吗?
我问#3的原因是因为我认为,即使我能够为此创建一个平台,我也需要在我的模块实体上定义平台实体的属性,以便进行验证和所有操作。
Here is the scenario, I'm developing an application using csla 3.8 / c#.net, the application will have different modules. its like an ERP, it will have accounting, daily time record, recruitment etc as modules.
Now the requirement is to check for common entities per module and build a "platform" (<- the boss calls it that way) from it. for example, DTR will have an entity "employee", Recruitment will have "Applicant" so one common entity that you can derive from both that can be put in the platform is "Person". "Person" will contain typical info like name, address, contact info etc.
I know it sounds like OOP 101. the thing is, i don't know how i am to go about it. how i wish it was just a simple inheritance but the requirement is like to create an API of some sort to be used by the modules using CSLA.
in csla you create smart objects right, inheriting from the base classes of csla like businessListbase, readonlylistbase etc. right? what if for example i created a businessbase Applicant class, it will have properties like salary demand, availability date etc. now for the personal info i will need the "Person" from the "platform" and implement it to the applicant class.
so in summary i have several questions:
- how to create such platform?
- if such platform is possible, how will it be implemented on each module's entities? (im already inheriting from base classes of csla)
- if incase 1 and 2 are possible, does it have advantages on development and maintenace of the app?
the reason why I'm asking #3 is because the way i see it, even if i am able to create a platform for that, i will be needing to define properties of the platform entity on my module entities so to have validation and all.
发布评论
评论(2)
关于从基类继承,您是正确的。
谢谢
-Blake Niemyjski(CodeSmith CSLA 模板 的作者)
You are correct about inheriting from the base classes.
Thanks
-Blake Niemyjski (Author of the CodeSmith CSLA Templates)
“平台”实体或我们现在所说的通用 BO 的主要目的是为了代码重用,因此当我们将来添加会计或采购等模块时,我们可以使用这些通用模块。
最后,我的解决方案是确定多个模块将使用的对象并将其分离到不同的项目中,以便其他模块在需要其中的对象时仅使用该项目。
对于我的第一个例子,申请人(用于招聘)、员工(每日时间记录)和人员(“平台”)。发生的事情是 Person 被放入通用 BO 项目中。并且申请人和雇员都只是使用人 BO 作为子财产。
感谢布莱克的回复。顺便说一句,我们实际上是在使用 Codesmith 来完成这个任务。还是谢谢你的建议。干杯!
the main purpose of the "platform" entities or what we call it now the Generics BOs is for code reuse so when we add modules in the future like accounting or purchasing we have those Generic modules at our disposal.
In the end, my solution was to just determine the Objects that would be used by multiple modules and separate it in a different project so other modules will just be using that project when they need an object from it.
as for my first example the applicant (for recruitment), employee (daily time record) and person ("platform"). what happened was Person was put on the generic BO proj. and both applicant and employee just uses person BO as a child property.
Thanks for the reply Blake. btw, we are really using codesmith for this one. thanks for the suggestion still. Cheers!