Beispiel #1
0
        public SqlSetup(ISetupObject setupObject)
        {
            ConnectionString = new SqlConnectionString(setupObject.ConnectionString, 30.Seconds());
            CommandText      = setupObject.CommandSourceType switch
            {
                CommandSourceType.File => ((FileName)setupObject.Command).Text,
                _ => setupObject.Command
            };

            CommandTimeout = setupObject.CommandTimeout;
            Parameters     = new Parameters.Parameters(setupObject.Parameters());
            Fields         = new Fields.Fields(setupObject.Fields());

            attributes = new StringHash <string>(true);
            loadAttributes(setupObject.Attributes);
        }
Beispiel #2
0
        public SqlSetup(Group setupGroup)
        {
            var connectionGroup = setupGroup.RequireGroup("connection").ForceValue();
            var connection      = new Connection(connectionGroup);

            ConnectionString = new SqlConnectionString(connection);

            var commandGroup = setupGroup.RequireGroup("command").ForceValue();
            var command      = new Command(commandGroup);

            CommandText    = command.Text;
            CommandTimeout = command.CommandTimeout;

            var parametersGroup = setupGroup.GetGroup("parameters");

            Parameters = new Parameters.Parameters(parametersGroup);

            var fieldsGroup = setupGroup.GetGroup("fields");

            Fields = new Fields.Fields(fieldsGroup);

            attributes = new StringHash <string>(true);
            loadAttributes(setupGroup.GetGroup("attributes"));
        }