Configured by the EntitySpaces section from the app or web config file.
Below is an example EntitySpaces configuration section as would be stored in the web.config or app.config file. Notice below on the "connectionInfo" element that the default is "MyMicrosoftDB". The default, in this case, "MyMicrosoftDB" will be used for all of your EntitySpaces provider calls. However, this can be easily overridden by overriding the connection name property. See the Name property of this class for more information. Notice that the "MyOracleDB" connection uses the providerMetadataKey of "esOracle". You SHOULD always use "esDefault" unless you are building a binary compatible, multi-database application.

Connection information is not serialized. <EntitySpaces> <connectionInfo default="MyMicrosoftDB"> <connections> <add name="MyMicrosoftDB" providerMetadataKey="esDefault" sqlAccessType="DynamicSQL" provider="Tiraggo.SqlClientProvider" providerClass="DataProvider" connectionString="User ID=sa;Password=secret;Initial Catalog=Northwind;Data Source=localhost;" commandTimeout="90" databaseVersion="2005"/> <add name="MyOracleDB" providerMetadataKey="esOracle" sqlAccessType="DynamicSQL" provider="Tiraggo.OracleClientProvider" providerClass="DataProvider" connectionString="Password=retina;Persist Security Info=True;User ID=MyDB;Data Source=127.0.0.1;" /> </connections> </connectionInfo> </EntitySpaces>
Exemple #1
0
        /// <summary>
        /// This initializes the tgDataRequest for the query.
        /// </summary>
        /// <param name="request">The request to populate.</param>
        protected void PopulateRequest(tgDataRequest request)
        {
            IMetadata meta = this.Meta;

            tgConnection conn = this.tg2.Connection;
            tgProviderSpecificMetadata providerMetadata = meta.GetProviderMetadata(conn.ProviderMetadataKey);

            IDynamicQuerySerializableInternal iQuery = this as IDynamicQuerySerializableInternal;

            if ((this.queries != null && this.queries.Count > 0) || iQuery.InternalSetOperations != null)
            {
                AssignProviderMetadata(this, new List <tgDynamicQuerySerializable>());
            }

            string catalog = conn.Catalog;
            string schema  = conn.Schema;

            iData.Catalog          = catalog;
            iData.Schema           = schema;
            iData.DataID           = meta.DataID;
            iData.ProviderMetadata = providerMetadata;
            iData.Columns          = meta.Columns;

            request.ConnectionString = conn.ConnectionString;
            request.CommandTimeout   = conn.CommandTimeout;
            request.QueryType        = tgQueryType.DynamicQuery;
            request.DynamicQuery     = this;
            request.DataID           = meta.DataID;
            request.ProviderMetadata = providerMetadata;

            request.Catalog = catalog;
            request.Schema  = schema;
            request.Columns = meta.Columns;

            if (this.m_selectAll)
            {
                _selectAll();
            }

            if (tg.QuerySource == null || tg.QuerySource.Length == 0)
            {
                tg.QuerySource = providerMetadata.Source;
            }
        }
        public tgConnection ConnectionServiceOverride(string connectionName)
        {
            if (this.connection == null)
            {
                this.connection = new tgConnection();

                this.connection.Name = connectionName;
            }

            return this.connection;
        }
Exemple #3
0
        /// <summary>
        ///
        /// </summary>
        private void AssignProviderMetadata(tgDynamicQuerySerializable query, List <tgDynamicQuerySerializable> beenThere)
        {
            if (beenThere.Contains(query))
            {
                return;
            }

            beenThere.Add(query);

            tgDynamicQuery theQuery = query as tgDynamicQuery;
            IDynamicQuerySerializableInternal iQuery = query as IDynamicQuerySerializableInternal;

            if (theQuery != null)
            {
                tgConnection conn = theQuery.tg2.Connection;

                if (iQuery.ProviderMetadata == null)
                {
                    tgProviderSpecificMetadata providerMetadata = theQuery.Meta.GetProviderMetadata(conn.ProviderMetadataKey);
                    iQuery.DataID           = theQuery.Meta.DataID;
                    iQuery.Columns          = theQuery.Meta.Columns;
                    iQuery.ProviderMetadata = providerMetadata;
                }

                iQuery.Catalog = conn.Catalog;
                iQuery.Schema  = conn.Schema;
            }

            // This code is for proxies as they are unable to work with column and provider metadata
            // until serialized back to the server
            if (iQuery.SelectAll)
            {
                foreach (tgColumnMetadata col in (tgColumnMetadataCollection)iQuery.Columns)
                {
                    tgQueryItem item = new tgQueryItem(this, col.Name, col.esType);
                    query.Select(item);
                }
            }
            else
            {
                List <tgQueryItem> columns = iQuery.SelectAllExcept;

                if (columns != null)
                {
                    foreach (tgColumnMetadata col in (tgColumnMetadataCollection)iQuery.Columns)
                    {
                        bool found = false;

                        for (int i = 0; i < columns.Count; i++)
                        {
                            if (col.Name == (string)columns[i])
                            {
                                found = true;
                                break;
                            }
                        }

                        if (found)
                        {
                            continue;
                        }

                        tgExpression item = new tgQueryItem(this, col.Name, col.esType);
                        query.Select(item);
                    }
                }
            }

            foreach (tgDynamicQuerySerializable subQuery in iQuery.queries.Values)
            {
                AssignProviderMetadata(subQuery, beenThere);
            }

            if (iQuery.InternalSetOperations != null)
            {
                foreach (tgSetOperation setOperation in iQuery.InternalSetOperations)
                {
                    AssignProviderMetadata(setOperation.Query, beenThere);
                }
            }
        }