Beispiel #1
0
        /// <summary>
        /// Get the requested instance.
        /// </summary>
        /// <param name="id">Instance unique identifier (DB).</param>
        /// <returns>The requested instance or <c>null</c> if the instance cannot be found.</returns>
        public static T Get(Int64 id, bool closeConnection = true)
        {
            T instance;

            // Check if the instance is in memory
            if (ORMEntity <T> .InMemoryTable.ContainsKey(id))
            {
                instance = ORMEntity <T> .InMemoryTable[id];
            }
            else
            {
                instance = ORMEntity <T> .ReadFromDatabase(id, closeConnection);
            }

            return(instance);
        }