protected override string GetDbProviderManifestToken(DbConnection connection)
        {
            EFIngresStoreVersion version = null;

            UsingConnection(connection, conn =>
            {
                version = EFIngresStoreVersionUtils.GetStoreVersion(conn);
            });

            return(version.Token);
        }
示例#2
0
        /// <summary>
        /// Get the EFIngresStoreVersion from the connection.
        /// </summary>
        /// <param name="connection">current sql connection</param>
        /// <returns>EFIngresStoreVersion corresponding to the current connection</returns>
        public static EFIngresStoreVersion GetStoreVersion(EFIngresConnection connection)
        {
            // IngresConnection.ServerVersion should be something like: "09.02.0001 II 9.2.1 (a64.lnx/103)NPTL"
            var match = Regex.Match(connection.ServerVersion, @"II (\w+)\.(\w+)\.(\w+)");

            if (match.Success)
            {
                var serverVersion = new EFIngresStoreVersion(int.Parse(match.Groups[1].Value),
                                                             int.Parse(match.Groups[2].Value),
                                                             int.Parse(match.Groups[3].Value));
                var version = EFIngresStoreVersion.Versions
                              .Where(x => x.CompareTo(serverVersion) <= 0)
                              .OrderByDescending(x => x)
                              .FirstOrDefault();
                if (version != null)
                {
                    return(version);
                }
            }
            throw new ArgumentException("The version of Ingres [ " + connection.ServerVersion + " ] is not supported via Ingres Entity Framework provider.");
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="manifestToken">A token used to infer the capabilities of the store</param>
 public EFIngresProviderManifest(string manifestToken)
     : base(GetProviderManifest())
 {
     _version = EFIngresStoreVersionUtils.GetStoreVersion(manifestToken);
 }