This class provides access to DevForce types, objects, etc. using reflection and dynamic typing. LINQPad creates an AppDomain per query tab, but will (usually) reuse that AppDomain for other queries executed on that tab. So statics can be useful, at least when the same query tab is reused.
Beispiel #1
0
        /// <summary>
        /// We're using the parameterless EM constructor, so no constructor arguments are provided.
        /// </summary>
        public override object[] GetContextConstructorArguments(IConnectionInfo cxInfo)
        {
            // We need to fix MEF probing in some circumstances, so let's check and do it before creating the EM.
            DevForceTypes.CheckComposition(cxInfo);

            return(null);
        }
Beispiel #2
0
        /// <summary>
        /// This is called after the EM is constructed.
        /// </summary>
        public override void InitializeContext(IConnectionInfo cxInfo, object context, QueryExecutionManager executionManager)
        {
            // Set properties on the EM now
            DevForceTypes.InitializeEntityManager(context);

            // Initialize sql logging if enabled.
            InitializeLogger(cxInfo);
        }
Beispiel #3
0
        /// <summary>
        /// This is used to determine when a property should be followed.
        /// We don't want to follow navigation properties.
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public static bool IsNavigationProperty(Type t)
        {
            if (t.IsGenericType)
            {
                Type iEnumerableOfT = t.GetInterface("System.Collections.Generic.IEnumerable`1");
                if (iEnumerableOfT != null)
                {
                    t = iEnumerableOfT.GetGenericArguments()[0];
                }
                else if (t.IsInterface && t.Name == "IEnumerable`1")
                {
                    t = t.GetGenericArguments()[0];
                }
            }
            // We do want to follow complex types, but not entities.
            var isEntity = IsEntityOrComplexType(t) && !DevForceTypes.IsComplexType(t);

            return(isEntity);
        }
Beispiel #4
0
 /// <summary>
 /// Add DevForce assemblies.
 /// </summary>
 public override IEnumerable <string> GetAssembliesToAdd()
 {
     return(DevForceTypes.GetAssembliesToAdd(_cxInfo.CustomTypeInfo.CustomAssemblyPath));
 }