public DbResInstance(DbResourceConfiguration configuration = null) { AutoAddResources = DbResourceConfiguration.Current.AddMissingResources; if (Configuration != null) { Configuration = configuration; } else { Configuration = DbResourceConfiguration.Current; } }
/// <summary> /// Core Configuration method that sets up the ResourceManager. For this /// implementation we only need the baseName which is the ResourceSet id /// (ie. the local or global resource set name) and the assembly name is /// simply ignored. /// /// This method essentially sets up the ResourceManager and holds all /// of the culture specific resource sets for a single ResourceSet. With /// ResX files each set is a file - in the database a ResourceSet is a group /// with the same ResourceSet Id. /// </summary> /// <param name="ConnectionString"></param> /// <param name="assembly"></param> protected void Initialize(string baseName, Assembly assembly) { // default configuration is static but you can override the configuration explicitly Configuration = DbResourceConfiguration.Current; ResourceSetName = baseName; AutoAddMissingEntries = DbResourceConfiguration.Current.AddMissingResources; // InternalResourceSets contains a set of resources for each locale InternalResourceSets = new Dictionary <string, ResourceSet>(); }
/// <summary> /// Core constructor for DbResourceReader. This ctor is passed the name of the /// ResourceSet and a culture that is to be loaded. /// </summary> /// <param name="resourceSetName">The base name of the resource reader</param> /// <param name="cultureInfo">The CultureInfo identifying the culture of the resources to be read</param> /// <param name="configuration">Configuration instance that's passed to the resource reader</param> public DbResourceReader(string resourceSetName, CultureInfo cultureInfo, DbResourceConfiguration configuration) { if (configuration != null) { Configuration = configuration; } else { Configuration = DbResourceConfiguration.Current; } this.resourceSetName = resourceSetName; this.cultureInfo = cultureInfo; }
/// <summary> /// Default constructor - only captures the parameter values /// </summary> /// <param name="virtualPath"></param> /// <param name="classname"></param> public DbResourceProvider(string virtualPath, string classname) { Configuration = DbResourceConfiguration.Current; lock (_SyncLock) { if (!ProviderLoaded) { ProviderLoaded = true; } // _virtualPath = virtualPath; _className = classname; DbResourceConfiguration.LoadedProviders.Add(this); } }
/// <summary> /// Static constructor for the Current property - guarantees this /// code fires exactly once giving us a singleton instance /// of the configuration object. /// </summary> static DbResourceConfiguration() { Current = new DbResourceConfiguration(); Current.Initialize(sectionName: "DbResourceConfiguration"); }
/// <summary> /// Static constructor for the Current property - guarantees this /// code fires exactly once giving us a singleton instance /// of the configuration object. /// </summary> static DbResourceConfiguration() { Current = new DbResourceConfiguration(); Current.Initialize(sectionName: "DbResourceConfiguration"); }
/// <summary> /// Static constructor for the Current property - guarantees this /// code fires exactly once giving us a singleton instance /// of the configuration object. /// </summary> static DbResourceConfiguration() { Current = new DbResourceConfiguration(true); }
/// <summary> /// Core constructor. Gets passed a baseName (which is the ResourceSet Id - /// either a local or global resource group) and a culture. /// /// This constructor basically creates a new ResourceReader and uses that /// reader's IEnumerable interface to provide access to the underlying /// resource data. /// </summary> /// <param name="baseName"></param> /// <param name="culture"></param> /// <param name="configuration"></param> public DbResourceSet(string baseName, CultureInfo culture, DbResourceConfiguration configuration) : base(new DbResourceReader(baseName, culture, configuration)) { }
/// <summary> /// Static constructor for the Current property - guarantees this /// code fires exactly once giving us a singleton instance /// of the configuration object. /// </summary> static DbResourceConfiguration() { Current = new DbResourceConfiguration(true); }