private void LoadProviderManifest(DbProviderManifest storeManifest) { foreach (PrimitiveType storeType in storeManifest.GetStoreTypes()) { this.AddInternal((GlobalItem)storeType); this._primitiveTypeMaps.Add(storeType); } foreach (GlobalItem storeFunction in storeManifest.GetStoreFunctions()) { this.AddInternal(storeFunction); } }
// <summary> // checks if the schemaKey refers to the provider manifest schema key // and if true, loads the provider manifest // </summary> // <param name="storeManifest"> The store manifest </param> private void LoadProviderManifest(DbProviderManifest storeManifest) { foreach (var primitiveType in storeManifest.GetStoreTypes()) { //Add it to the collection and the primitive type maps AddInternal(primitiveType); _primitiveTypeMaps.Add(primitiveType); } foreach (var function in storeManifest.GetStoreFunctions()) { AddInternal(function); } }
/// <summary> /// checks if the schemaKey refers to the provider manifest schema key /// and if true, loads the provider manifest /// </summary> /// <param name="connection">The connection where the store manifest is loaded from</param> /// <param name="checkForSystemNamespace">Check for System namespace</param> /// <returns>The provider manifest object that was loaded</returns> private void LoadProviderManifest(DbProviderManifest storeManifest, bool checkForSystemNamespace) { foreach (PrimitiveType primitiveType in storeManifest.GetStoreTypes()) { //Add it to the collection and the primitive type maps this.AddInternal(primitiveType); _primitiveTypeMaps.Add(primitiveType); } foreach (EdmFunction function in storeManifest.GetStoreFunctions()) { AddInternal(function); } }
/// <summary> /// Main driver function. /// </summary> /// <param name="args"></param> public static void Generate(string outputFileName) { //The following functions are omitted because they have counterparts in the BCL string[] omittedFunctions = new[] { "Sum", "Min", "Max", "Average", "Avg", "Count", "BigCount", "Trim", "RTrim", "LTrim", "Concat", "Length", "Substring", "Replace", "IndexOf", "ToUpper", "ToLower", "Contains", "StartsWith", "EndsWith", "Year", "Month", "Day", "DayOfYear", "Hour", "Minute", "Second", "Millisecond", "CurrentDateTime", "CurrentDateTimeOffset", "CurrentUtcDateTime", "BitwiseAnd", "BitwiseOr", "BitwiseXor", "BitwiseNot", "Round", "Abs", "Power", "NewGuid", "Floor", "Ceiling", }; //The following functions are omitted from SqlFunctions because they already exist in EntityFunctions string[] omittedSqlFunctions = new[] { "STDEV", "STDEVP", "VAR", "VARP", "COUNT_BIG", "Left", "Right", "Reverse", "GetTotalOffsetMinutes", "TruncateTime", "CreateDateTime", "CreateDateTimeOffset", "CreateTime", "Add", "Diff", "Truncate", "SYSDATETIME", "SYSUTCDATETIME", "SYSDATETIMEOFFSET", "LEN", "LOWER", "UPPER", "NEWID", }; DbProviderServices dbProviderServices = (DbProviderServices)((IServiceProvider)JetProviderFactory.Instance).GetService(typeof(DbProviderServices)); DbProviderManifest dbProviderManifest = dbProviderServices.GetProviderManifest("Jet"); var storeFunctions = dbProviderManifest.GetStoreFunctions(); IEnumerable <EdmFunction> sqlFunctions = storeFunctions .Where(f => f.NamespaceName == "Jet") .Where(f => !(omittedFunctions.Concat(omittedSqlFunctions)).Contains(f.Name, StringComparer.OrdinalIgnoreCase)); FunctionStubFileWriter sqlStubsFileWriter = new FunctionStubFileWriter(sqlFunctions, GetFunctionNamingDictionary(), GetParameterNamingDictionary()); sqlStubsFileWriter.GenerateToFile(outputFileName, "JetEntityFrameworkProvider", "JetFunctions", "Jet", true); }
/// <summary> /// checks if the schemaKey refers to the provider manifest schema key /// and if true, loads the provider manifest /// </summary> /// <param name="connection"> The connection where the store manifest is loaded from </param> /// <returns> The provider manifest object that was loaded </returns> private void LoadProviderManifest(DbProviderManifest storeManifest) { foreach (var primitiveType in storeManifest.GetStoreTypes()) { //Add it to the collection and the primitive type maps AddInternal(primitiveType); _primitiveTypeMaps.Add(primitiveType); } foreach (var function in storeManifest.GetStoreFunctions()) { AddInternal(function); } }