Class Property Data Types Explained In Detail
Published Feb 15 2019 04:25 AM 1,189 Views
First published on TECHNET on Dec 01, 2010

If you are not already familiar with modeling concepts please see this blog post first:

http://blogs.technet.com/b/servicemanager/archive/2010/04/05/modeling-in-system-center-service-...

When you define a property on a class you need to choose a data type for that property.  Sometimes this is obvious – if you are going to store a date property value choose the datetime data type.  If you are going to be storing a true/false value choose a Boolean value.  This blog post will provide a comprehensive explanation of the different data types that are available to help you choose which one is right to store your data.

These are the data types as defined by the 1.1 version of the MP Schema:

<xsi:simpleType name="ManagementPackEntityPropertyTypes">
<xsi:restriction base="xsd:string">
<xsi:enumeration value="int"/>
<xsi:enumeration value="decimal"/>
<xsi:enumeration value="double"/>
<xsi:enumeration value="string"/>
<xsi:enumeration value="datetime"/>
<xsi:enumeration value="guid"/>
<xsi:enumeration value="bool"/>
<xsi:enumeration value="enum"/>
<xsi:enumeration value="richtext"/>
<xsi:enumeration value="binary"/>
</xsi:restriction>
</xsi:simpleType>

They are the same data types as found in the version 1.0 MP schema used in SCOM/SCE 2007 (including R2) except that there are three new data types (highlighted) in the 1.1 version of the schema used in SCSM.  SCOM v.Next will pick up those new data types when it adopts the newest version of the common MP schema.



Each data type value results in a column being created in a SQL Server database table.  That column in the SQL Server database table has to be of a SQL Server data type.  This is how the mapping works:





MP Schema Data Type





SQL Server Column Data Type



PropertyType Value on the ManagedTypeProperty Table

Notes



int int 0

-2^31 (-2,147,483,648)



to



2^31-1 (2,147,483,647)



4 bytes


decimal decimal 1

Precision: 38

17 bytes


double float 2

- 1.79E+308



to



-2.23E-308



,0,



and



2.23E-308



to



1.79E+308



Precision: 53



8 bytes


string nvarchar(n) 3 n = the value of the MaxLength attribute defined on the Property element.




Default n = 256


Max: the maximum storage size is 2^31-1 bytes




Special note:
values of any property that has n > 4000 will not be copied to the data warehouse.
datetime datetime 4 Precision: 23




8 bytes
guid uniqueidentifier 5 16 bytes
bool bit 6 1 = TRUE

0 = FALSE





<1 byte
enum uniqueidentifier 7 Stores a GUID which is effectively a foreign key from the EnumType table and represents the currently selected EnumerationValue (aka “List Item”)




16 bytes
richtext nvarchar(n) 8 n = the value of the MaxLength attribute defined on the Property element.




Default n = 256




Special note:
values of any property that has n > 4000 will not be copied to the data warehouse.





Special note: use this data type to store property values which are in RTF format.
binary uniqueidentifier is a foreign key to a table that has a varbinary(max) field to store the binary data 9 varbinary(max) stores up to 2^31-1 bytes




16 bytes for the GUID FK




Some best practices:




  • Binary data and nvarchar with n > 4000 properties will not have their data moved to the DW in SCSM 2010.  Do not use those data types if you want your data to show up in the DW and reports.


  • Use datetime for storing date/time property values.


  • Use bool for storing True/False values.


  • Depending on the size of the number you want to store, choose int, decimal, or double.  Choose the smallest storage size possible given the range of numbers you expect.  Keep in mind that even if the number you store is ‘1’, if you use double it will store it as 8 bytes.  Avoid using decimal unless you really need that level of precision.


  • Use the smallest n that you know will fit your data.  If not sure, err on the high side.


  • Use binary data type for storing big chunks of data like file attachments, images, binary blobs, etc.


  • Use GUID for easily storing unique ID values.


  • Use enum for those properties where the values that are allowed come from a predefined list of values.  For more information on enums see this blog posts .

Version history
Last update:
‎Mar 11 2019 08:36 AM
Updated by: