如何进行768,16一个参数表设计和bussinesses和GUI层中使用? [英] How shoud be a parameters table designed and used on bussinesses and GUI layers?

查看:195
本文介绍了如何进行768,16一个参数表设计和bussinesses和GUI层中使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在设计一个应用程序,我需要知道如何应设计一个常量参数表。另外,我想知道如何使用应用程序这个表。
例如:在一个系统参数性别(M或F),它应该是在自己的表或者是更好地与他人的参数,一个特殊的表?如何在随后的层可以我信封参数(使用常量类的参数和它们的主键)?

I'm currently designing an application and I need to know how should be designed a constants parameter table. Also, I want to know how to use this table on the application. For example: for a parameter sex (M or F) in a system, it should be in its own table or is better to have that parameter with others in a special table?. How can I "envelope" parameters in the subsequent layers (using a constants class with the parameters and their primary keys)?

我听说有一个特殊的DB模式,或创建一个表,使得其架构让开发过程中传达这个单一参数表中的一种常见方式。你知不知道这个怎么叫?

I have heard about a special "DB pattern" or a common way to create a table such that its schema lets the development process to relay on this single parameter table. Do you know how's this called?

另外...你能不能给我推荐什么好的书目的问题?

Also... could you recommend me any good bibliography on the issue?

推荐答案

我已经建立并多次使用我所说的参数枚举表的。该模块是我 ZXAF开源框架的一部分。

I've built and used many times what I call Parameter Enumeration Tables. The module is part of my ZXAF opensource framework.

基本的设计很简单,你有一个有一个需要parametrised场每桌1一对多关系的参数表。它看起来是这样的:

Basic design is simple, you have a Parameters table that has a 1-many relationship with each table that needs a parametrised field. It looks something like this:

扩展在此提供一个真实的例子,在那里我们有一个用户表包含状态工作领域。我们指数通过现场链接到 PARAMS 表中的约束的如下:

Expanding on this to provide a real example, where we are working with a users table that contains a status field. We index and link the field to the params table via a constraint as follows;

INDEX `FK_user_status` (`status`),
CONSTRAINT `FK_user_status` FOREIGN KEY (`status`) REFERENCES `params` (`id`) 
           ON UPDATE CASCADE ON DELETE CASCADE

注:我使用 CASCADE 在这里,有些时候,你不想做这个

NOTE: I'm using CASCADE here, there are times when you don't want to do this

这给了我们下面的模式;

This gives us the following schema;

这样做的关键概念是允许数据库包含保持参照完整性,并与code中的数据模型集成了参数化的数据。在code是能够通过查询数据库实体如何与找出来,例如什么特定领域的有效值为

The key concept of this is to allow the database to contain parameterised data that maintains referential integrity, and integrates with a data model within the code. The code is able to find out by querying the database how entities are related, and for example what the valid values for a specific field are.

最后我想介绍和讲解的 元组 。这是另一种表,使我们能够在一对参数(元组)与值相关联。这是一个数据中立的方式,使我们可以延长 PET 提供查询和预期值。这是最适合于可扩展的模型,其中,可以增加新的枚举,但我们需要以允许它们包含一个值。 _it往往是更好地做到这一点的关系 _

Lastly I want to introduce and explain the concept of Parameters Tuples. This is another table that allows us to associate a pair of parameters (the Tuple) with a value. This a data neutral way in which we can extend PET provide the lookup and expected values. This is most suited to an extensible model where it is possible to add new enumerations, and yet we need to allow them to contain a value. _It is often better to do this with relationships_

我不是青睐,但这只是我的意见,这可能是你快乐的东西。

I'm not in favour of enums in databases, but this is only my opinion and it may be something that you're happy with.

这篇关于如何进行768,16一个参数表设计和bussinesses和GUI层中使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆