/// <summary> /// Returns the text to display in the root Schema Explorer node for a given connection info. /// </summary> /// <param name="cxInfo">The cx info.</param> /// <returns></returns> public override string GetConnectionDescription(IConnectionInfo cxInfo) { if (cxInfo == null) { return("<null>"); } var templateGroup = CxInfoHelper.GetTemplateGroup(cxInfo); return(string.Format("{0} - {1}", templateGroup.ToString(), Path.GetFileNameWithoutExtension(CxInfoHelper.GetEntityAssemblyFilename(cxInfo, templateGroup)))); }
/// <summary> /// Obtains the and set entity assembly namespaces. /// </summary> /// <param name="cxInfo">The cx info.</param> private void ObtainAndSetEntityAssemblyNamespaces(IConnectionInfo cxInfo) { var entityAssemblyFilename = CxInfoHelper.GetEntityAssemblyFilename(cxInfo, CxInfoHelper.GetTemplateGroup(cxInfo)); if (string.IsNullOrEmpty(entityAssemblyFilename)) { return; } var assembly = DataContextDriver.LoadAssemblySafely(entityAssemblyFilename); var namespaces = assembly.GetTypes().Select(t => t.Namespace).Distinct().ToArray(); CxInfoHelper.SetDriverDataElement(cxInfo, DriverDataElements.EntityAssemblyNamespacesElement, String.Join(",", namespaces)); }
/// <summary> /// Verifies the version of the entity assembly, whether it's of a version this driver can work with. /// </summary> private void VerifyEntityAssemblyVersion() { if (_linqMetaDataType == null) { throw new InvalidOperationException("No ILinqMetaData type found."); } var ormSupportClassesAssemblyName = _linqMetaDataType.Assembly.GetReferencedAssemblies() .Where(an => (an.Name == "SD.LLBLGen.Pro.ORMSupportClasses") && (an.Version.Major == Constants.MajorVersion) && (an.Version.Minor == Constants.MinorVersion)).FirstOrDefault(); if (ormSupportClassesAssemblyName == null) { throw new InvalidOperationException(string.Format("The assembly '{0}' is not compiled against the LLBLGen Pro Runtime Framework v{1}.{2}.", CxInfoHelper.GetEntityAssemblyFilename(_cxInfo, CxInfoHelper.GetTemplateGroup(_cxInfo)), Constants.MajorVersion, Constants.MinorVersion)); } }