Example #1
0
        /// <summary>
        /// Returns a list of additional namespaces that should be imported automatically into all
        /// queries that use this driver.
        /// </summary>
        /// <param name="cxInfo"> Connection information, as entered by the user. </param>
        /// <returns> List of additional namespaces. </returns>
        public override IEnumerable <string> GetNamespacesToAdd(IConnectionInfo cxInfo)
        {
            var bondInEtwProperties = new BondInEtwProperties(cxInfo);

            IEnumerable <string> result = null;

            try
            {
                var driverDirectory = Path.GetDirectoryName(Assembly.GetAssembly(this.GetType()).Location);

                result = GetAssemblyTypes(driverDirectory)
                         .Concat(TypeCache.GetTypes(bondInEtwProperties.ContextName))
                         .Select(type => type.Namespace)
                         .Where(@namespace => @namespace != null)
                         .Concat(namespaces)
                         .Distinct();
            }
            catch
            {
                // Ignore
            }

            return(result);
        }
Example #2
0
        /// <summary>
        /// Returns a list of additional assemblies to reference when building queries.
        /// </summary>
        /// <param name="cxInfo"> Connection information, as entered by the user. </param>
        /// <returns> List of additional assemblies. </returns>
        public override IEnumerable <string> GetAssembliesToAdd(IConnectionInfo cxInfo)
        {
            var bondInEtwProperties     = new BondInEtwProperties(cxInfo);
            IEnumerable <string> result = null;

            try
            {
                var driverDirectory = Path.GetDirectoryName(Assembly.GetAssembly(this.GetType()).Location);

                result = GetAssemblyTypes(driverDirectory)
                         .Concat(TypeCache.GetTypes(bondInEtwProperties.ContextName))
                         .Select(type => type.Assembly)
                         .Concat(assemblies)
                         .Distinct()
                         .Select(assembly => assembly.Location)
                         .ToList();
            }
            catch (Exception error)
            {
                // Ignore
            }

            return(result);
        }