コード例 #1
0
        private void InvokeOnConfigure(DataflipConfigurationEventArgs e)
        {
            if (e.Settings == null)
            {
                e.Settings = new DataflipSettings();
            }

            if (Configure != null)
            {
                Configure(e);
            }

            Settings = e.Settings;
        }
コード例 #2
0
        public DataflipContext(string contextName)
        {
            DataflipConfigurationEventArgs e = new DataflipConfigurationEventArgs();

            e.ContextName = contextName;
            InvokeOnConfigure(e);

            if (string.IsNullOrEmpty(Settings.ConnectionString))
            {
                throw new DataflipSettingsException(
                          $"The settings haven't been configured for the '{contextName}' context yet. The following line (or something that performs a similar operation) is required before instantiating this class: \n\n"
                          +
                          "DataflipContext.Configure += (df) => df.Settings.ConnectionString = \"{connectionString goes here}\";"
                          );
            }
        }