Beispiel #1
0
 protected virtual void RunSql(MicrosoftAdoManager manager)
 {
     this.RunSqlClient(manager);
 }
Beispiel #2
0
 /// <summary>
 /// Creates a new Microsoft SQL Server ADO Dataset
 /// </summary>
 /// <param name="manager">Microsoft SQL Server ADO Manager</param>
 public MicrosoftAdoDataset(MicrosoftAdoManager manager)
     : base(manager)
 {
 }
Beispiel #3
0
        /// <summary>
        /// Attempts to load an Object of the given type identified by the given Node and returned as the Type that this loader generates
        /// </summary>
        /// <param name="g">Configuration Graph</param>
        /// <param name="objNode">Object Node</param>
        /// <param name="targetType">Target Type</param>
        /// <param name="obj">Created Object</param>
        /// <returns>True if the loader succeeded in creating an Object</returns>
        public bool TryLoadObject(IGraph g, INode objNode, Type targetType, out object obj)
        {
            obj = null;

            INode  managerNode;
            Object temp;

            //Create the URI Nodes we're going to use to search for things
            INode propServer = ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyServer),
                  propDb     = ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyDatabase);


            switch (targetType.FullName)
            {
            case MicrosoftAdoDataset:
                managerNode = ConfigurationLoader.GetConfigurationNode(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyGenericManager));
                if (managerNode != null)
                {
                    temp = ConfigurationLoader.LoadObject(g, managerNode);
                    if (temp is MicrosoftAdoManager)
                    {
                        obj = new MicrosoftAdoDataset((MicrosoftAdoManager)temp);
                    }
                    else
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the object identified by the Node '" + objNode.ToString() + "' since the object pointed to by the dnr:genericManager property could not be loaded as an instance of the required MicrosoftAdoManager class");
                    }
                }
                else
                {
                    throw new DotNetRdfConfigurationException("Unable to load the object identified by the Node '" + objNode.ToString() + "' as it specified a dnr:type of MicrosoftAdoDataset but failed to specify a dnr:genericManager property to point to a MicrosoftAdoManager");
                }
                break;

            case AzureAdoManager:
            case MicrosoftAdoManager:
                //Get Server and Database details
                String server = ConfigurationLoader.GetConfigurationString(g, objNode, propServer);
                if (server == null)
                {
                    server = "localhost";
                }
                String db = ConfigurationLoader.GetConfigurationString(g, objNode, propDb);
                if (db == null)
                {
                    return(false);
                }

                //Get user credentials
                String user, pwd;
                ConfigurationLoader.GetUsernameAndPassword(g, objNode, true, out user, out pwd);

                bool encrypt = ConfigurationLoader.GetConfigurationBoolean(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyEncryptConnection), false);

                String        mode       = ConfigurationLoader.GetConfigurationString(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyLoadMode));
                AdoAccessMode accessMode = (mode != null ? (AdoAccessMode)Enum.Parse(typeof(AdoAccessMode), mode) : AdoAccessMode.Streaming);

                //Create the Manager
                if (user != null && pwd != null)
                {
                    if (targetType.FullName.Equals(MicrosoftAdoManager))
                    {
                        obj = new MicrosoftAdoManager(server, db, user, pwd, encrypt, accessMode);
                    }
                    else
                    {
                        obj = new AzureAdoManager(server, db, user, pwd, accessMode);
                    }
                }
                else
                {
                    if (targetType.FullName.Equals(AzureAdoManager))
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the object identified by the Node '" + objNode.ToString() + "' as an AzureAdoManager as the required dnr:user and dnr:password properties were missing");
                    }
                    obj = new MicrosoftAdoManager(server, db, encrypt, accessMode);
                }
                break;

            case MicrosoftAdoOptimiser:
                managerNode = ConfigurationLoader.GetConfigurationNode(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyGenericManager));
                if (managerNode != null)
                {
                    temp = ConfigurationLoader.LoadObject(g, managerNode);
                    if (temp is MicrosoftAdoManager)
                    {
                        obj = new MicrosoftAdoOptimiser((MicrosoftAdoManager)temp);
                    }
                    else
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the object identified by the Node '" + objNode.ToString() + "' since the object pointed to by the dnr:genericManager property could not be loaded as a MicrosoftAdoManager instance");
                    }
                }
                else
                {
                    throw new DotNetRdfConfigurationException("Unable to load the object identified by the Node '" + objNode.ToString() + "' as it specified a dnr:type of AdoOptimiser but failed to specify a dnr:genericManager property to point to a MicrosoftAdoManager instance");
                }
                break;
            }

            return(obj != null);
        }
Beispiel #4
0
 /// <summary>
 /// Creates a new Microsoft SQL Server ADO Optimiser
 /// </summary>
 /// <param name="manager">Microsoft SQL Server ADO Store Manager</param>
 public MicrosoftAdoOptimiser(MicrosoftAdoManager manager)
     : base(manager)
 {
 }