Example #1
0
        /// <summary>
        /// Initializes the context by applying the builder config, registering the entities and opening the database connection
        /// </summary>
        /// <param name="options">The DataContextBuilder which will be used to configure the context</param>
        private void OnInit(DataContextBuilder options)
        {
            // Run the builder through OnConfigure incase it is implemented
            OnConfigure(options);

            // Apply all the options from the builder
            dbDriver     = options.DbDriver;
            deserializer = options.Deserializer;
            logger       = options.Logger;
            isLogging    = options.Logging;
            IsConfigured = true;

            OnEntityRegister();
            dbDriver.OpenConnection(logger);
            if (isLogging)
            {
                logger.Log($"{this.GetType().Name} has been initialized with driver: {dbDriver.DriverName} ({dbDriver.GetType().FullName})");
            }
        }