This project is read-only.

Modelling rules

Following rules must be followed for successful use of IOG.


  • All entities are defined as interfaces with properties
    • property may be of interface type, which is used for modelling references to other objects
    • property may be of scalar type from following list: Boolean, String, Int32, Int64, Double, DateTime, Guid, TimeSpan, Byte, Char
    • scalar type aliases such as string or int are allowed
    • user defined enumerations are allowed

Collections and dictionaries

  • Property may be of collection type, declared as ICollection<type>
    • collection element may be other entity interface or scalar
    • collection does not keep ordering of elements, enumerating through collection gives random element order
    • to keep order within collection use IOrderedCollection<type>
  • Property may be of indexed collection type, declared as IIndexedCollection<type>
    • indexed collection requires that element type declares a primary key, see Attributes
    • primary key must be unique within an indexed collection
    • elements are ordered by the primary key when enumerating through collection in ascending order
    • indexed collection allows fast retrieval of elements by key
  • Property may be of dictionary type, declared as IDictionary<tkey, tvalue>
    • type of key must be a scalar type
    • type of value can be scalar or interface type

Inheritance and root entity

  • Inheritance is allowed in the data model, except from ICollection/IDictionary
  • One root entity must encompass the entire data model
    • root would typically have collections of entities in the database
    • root type is used when constructing the Context

Modelling recommendations

Following recommendations are best practices for entity modelling which would lead to optimal performance of the IOG.

Separate entities assembly

  • It is recommended that entity types are stored in separate class library project
    • This would make for easier initialization of IOG because it would automatically register all types from the assembly where the root entity is stored
    • Otherwise all entity types must be listed manually when creating the context

Use IIndexedCollection and IDictionary when possible

  • It is recommended to use IIndexedCollection and IDictionary when possible in the data model
    • Both would give fast access to elements by key
    • When there is inheritance in the data model, avoid using base types (which have descendants) as type of collection element or dictionary value type, because polymorphism takes some extra time

Maximize use of Immutable data

  • It is recommended to maximize use of ImmutableAttribute in the data model
    • It would take less data for storage and faster commit
    • It would have benefit for application because such data is read only and cannot be changed by mistake

Last edited Jun 8, 2012 at 1:00 PM by nenadsabo, version 7


No comments yet.