简体   繁体   English

.NET的标准业务逻辑数据类

[英]Standard business logic data classes for .NET

There are a lot of "primitive" boiler plate types of data classes that could appear in many different programs. 有很多“原始”锅炉板类型的数据类可以出现在许多不同的程序中。

However, I have never seen a class or library set that recognizes the need to combine all these things with common logic required for them such as validation. 但是,我从未见过一个类或库集,它们认识到需要将所有这些内容与它们所需的通用逻辑相结合,例如验证。

Example classes ([] brackets correspond to classes also in hypothetical library): 示例类([]括号对应于假设库中的类):

Address (street, postal code, city, state/territory/province, country) 地址(街道,邮政编码,城市,州/领地/省,国家)
Person (name, contact info ([Phone]/[Email]/etc), [Address], SSN/TIN, [CreditCard]) 人(姓名,联系信息([电话] / [电子邮件] /等),[地址],SSN / TIN,[CreditCard])
Phone (number, country code, etc) 电话(号码,国家代码等)
CreditCard (type, number, expiration, ccv) ** CreditCard(类型,数量,到期日期,ccv)**

And I'm sure someone could come up with plenty of others. 我相信有人可以拿出很多其他人。

I have developed my own Phone/Address/Person/CreditCard classes that I use in projects, complete with validation and logic. 我开发了自己的电话/地址/人员/信用卡课程,我在项目中使用,完成验证和逻辑。

However I only am capable of validating US based information. 但是我只能验证美国的信息。 My phone number class would ideally inherit from a base Phone class, as mine actually seperates the number into NPA, NXX and Station and validates it fully with NANP standards. 理想情况下,我的电话号码类将从基本电话类继承,因为我实际上将数字分成NPA,NXX和Station,并使用NANP标准完全验证它。

Is there a set of libraries out there in the net that has a comprehensive collection of such boiler plate data classes with proper validation? 网络中是否有一组库具有全面的锅炉板数据类集合以及适当的验证?

Does it include validation for a world wide set of data, or just US data? 它是否包括对全球数据集或仅美国数据的验证?

And for the ** from CreditCard, is it capable of meeting PCI Data Security Standards? 对于来自CreditCard的**,它是否能够满足PCI数据安全标准?

I know these are classes many people have probably written many times in many different languages, but is there any .NET library that fufills these desires? 我知道这些是许多人可能用许多不同语言写过很多次的类,但有没有任何.NET库可以满足这些需求?

I would prefer opens source/free, though I would consider a paid 3rd party library set. 我更喜欢打开源/免费,但我会考虑付费的第三方库集。

CSLA.NET might offer close to what yoju're looking for. CSLA.NET可能提供接近yoju正在寻找的东西。 It probably takes it a bit further than what you are asking, but it has some of the most comprehensive documentation of any framework (ie published books from APress). 它可能比你要求的更进一步,但它有一些最全面的任何框架文档(即来自APress的出版书籍)。 It is also free. 它也是免费的。

In particular the CSLA.ValidationRules namespace and the CommonRules and CustomRules classes focus on data validation. 特别是CSLA.ValidationRules命名空间和CommonRules和CustomRules类专注于数据验证。

It might be handy to have a schema for typical implementations of various objects when starting a project, however actual implementations would be specific, requiring specific behaviours and validation requirements. 在启动项目时为各种对象的典型实现提供模式可能很方便,但实际实现将是特定的,需要特定的行为和验证要求。 This is probably why ORM or Business Object framework generation tools require a input schema to create the classes. 这可能是ORM或Business Object框架生成工具需要输入模式来创建类的原因。

If a standard class framework existed, that was open-source, you would find that this schema would be massive and continually growing, this would make it difficult to keep an application updated. 如果存在一个标准的类框架,那就是开源的,你会发现这个模式会很庞大并且不断增长,这会使得更新应用程序变得困难。 Each class and property of that class would require a lot of documentation with ways they could be used etc, but this could be subjective. 该类的每个类和属性都需要大量文档以及可以使用的方式等,但这可能是主观的。 A schema where one could select what they want and how it should be validated, to be used in an ORM / Business Object generation framework might be good idea and am sure they don't currently exist. 在ORM /业务对象生成框架中使用的可以选择他们想要的以及如何验证它的模式可能是个好主意并且确定它们当前不存在。

You could have a look at specific existing open-source projects with similar functionality and use that for inspiration? 您可以查看具有类似功能的特定现有开源项目,并将其用于灵感?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM