数据库变更
1-从iC_ProductFeature表中删除了列维数
2-添加了新表iC_ProductDimensions来保存产品的不同尺寸数据。以下是iC_ProductDimensions中使用的不同列的详细说明
1- DimensionId - This is the primary key in the table and of bigint datatype.
2- UOMID - (FK) Unit of Measurement ID , this is refrenced from the table iC_ProductUnitOfMeasure.
3- ProductFeatureId : This is referenced column from the iC_ProductFeature table.
4- NumericValue : This column stores the dimensional value (e.g. if UOM is pound and this column stores 10 than we can say that Weight of product is 10 pound.
3-在iC_ProductUnitOfMeasure中添加了一列“ MeasurementType”。
4-将ProductFeatureId的数据类型从varchar(100)更改为Bigint
数据流
iC_ProductUnitOfMeasure中的“ MeasurementType”将存储为其创建度量单位的度量。
e.g. let's take a snapshot view of rows in iC_ProductUnitOfMeasure
UOMID Abbrivation MeasurementType Description
1 lb Weight This UOM is used for measuring weight of the product
2 inch. Width This UOM is used for measuring width of the product
3 meter Length This UOM is used for measuring length of the product
4 Kg Weight This UOM is used for measuring weight of product in Kg.
在上面的示例中,我们已使用关联的MeasurementType标记了每个UOM。
UOM 1可以用来测量磅产品重量,UOM 4可以用来测量公斤产品重量。
添加产品长度为0.5米,产品宽度为50英寸,产品重量为100磅的产品。
1-在iC_Product表中创建一条记录以存储产品的通用属性。 (Suppopse ProductId = ICPR0001)
2-在iC_ProductFeature中创建一条记录,并存储常见的产品功能,例如color,size,s / w,h / w功能(如果有)。 (假设ProductFeatureId = 1)
3-在iC_ProductDimesion表中创建3条记录,如下所示。
DimensionID UOMID ProductFeatureId NumericValue
1 1 1 100
2 2 1 50
3 3 1 0.5
4-在iC_ProductFeatureApplicability中添加一条记录,其中(ProductId = ICPR0001和ProductFeatureId = 1)
查询数据以获得产品ICPR001的不同尺寸值
select
product .* ,
productFeature.* ,
( CAST (dimension.NumericValue as Varchar(100) )+" " + UOM.Abbrivation) as Dimension ,
dimension.MeasurementType
from
iC_Product product ,
iC_ProductFeature productFeature ,
iC_ProductFeatureApplicability ,
iC_ProductDimesions dimension ,
iC_ProductUnitOfMeasure UOM
where
iC_ProductFeatureApplicability.ProductId = product.ProductId
and
iC_ProductFeatureApplicability.ProductFeatureId = productFeature.ProductFeatureId
and
dimension.ProductFeatureId = productFeature.ProductFeatureId
and
dimension.UOMID= UOM.UOMID
and
product.ProductId = 'ICPR001'
最佳答案
真正的单例只能实例化一次(在某些实现中,每个线程实例化)。
Unity生命周期管理只是让Unity始终返回同一实例的一种选择;该实例实际上不太可能被设计为单例,因此原则上您仍然可以手动创建其他实例。
有关区别的更多信息,请参见我对this question的回答。