本文整理汇总了C#中System.Configuration.FactoryRecord类的典型用法代码示例。如果您正苦于以下问题:C# FactoryRecord类的具体用法?C# FactoryRecord怎么用?C# FactoryRecord使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FactoryRecord类属于System.Configuration命名空间,在下文中一共展示了FactoryRecord类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateSection
// parentConfig contains the config that we'd merge with.
override protected object CreateSection(bool inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, object parentConfig, ConfigXmlReader reader) {
// Get the factory used to create a section.
RuntimeConfigurationFactory factory = (RuntimeConfigurationFactory) factoryRecord.Factory;
// Use the factory to create a section.
object config = factory.CreateSection(inputIsTrusted, this, factoryRecord, sectionRecord, parentConfig, reader);
return config;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:RuntimeConfigurationRecord.cs
示例2: AddConfigurationSection
internal void AddConfigurationSection(string group, string name, ConfigurationSection configSection)
{
if (base.IsLocationConfig)
{
throw new InvalidOperationException(System.Configuration.SR.GetString("Config_add_configurationsection_in_location_config"));
}
BaseConfigurationRecord.VerifySectionName(name, null, false);
if (configSection == null)
{
throw new ArgumentNullException("configSection");
}
if (configSection.SectionInformation.Attached)
{
throw new InvalidOperationException(System.Configuration.SR.GetString("Config_add_configurationsection_already_added"));
}
string configKey = BaseConfigurationRecord.CombineConfigKey(group, name);
if (base.FindFactoryRecord(configKey, true) != null)
{
throw new ArgumentException(System.Configuration.SR.GetString("Config_add_configurationsection_already_exists"));
}
if (!string.IsNullOrEmpty(configSection.SectionInformation.ConfigSource))
{
this.ChangeConfigSource(configSection.SectionInformation, null, null, configSection.SectionInformation.ConfigSource);
}
if (this._sectionFactories != null)
{
this._sectionFactories.Add(configKey, new FactoryId(configKey, group, name));
}
string type = configSection.SectionInformation.Type;
if (type == null)
{
type = base.Host.GetConfigTypeName(configSection.GetType());
}
FactoryRecord factoryRecord = new FactoryRecord(configKey, group, name, type, configSection.SectionInformation.AllowLocation, configSection.SectionInformation.AllowDefinition, configSection.SectionInformation.AllowExeDefinition, configSection.SectionInformation.OverrideModeDefaultSetting, configSection.SectionInformation.RestartOnExternalChanges, configSection.SectionInformation.RequirePermission, this._flags[0x2000], false, base.ConfigStreamInfo.StreamName, -1) {
Factory = System.Configuration.TypeUtil.GetConstructorWithReflectionPermission(configSection.GetType(), typeof(ConfigurationSection), true),
IsFactoryTrustedWithoutAptca = System.Configuration.TypeUtil.IsTypeFromTrustedAssemblyWithoutAptca(configSection.GetType())
};
base.EnsureFactories()[configKey] = factoryRecord;
SectionRecord sectionRecord = base.EnsureSectionRecordUnsafe(configKey, false);
sectionRecord.Result = configSection;
sectionRecord.ResultRuntimeObject = configSection;
if (this._removedSections != null)
{
this._removedSections.Remove(configKey);
}
configSection.SectionInformation.AttachToConfigurationRecord(this, factoryRecord, sectionRecord);
string rawXml = configSection.SectionInformation.RawXml;
if (!string.IsNullOrEmpty(rawXml))
{
configSection.SectionInformation.RawXml = null;
configSection.SectionInformation.SetRawXml(rawXml);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:53,代码来源:MgmtConfigurationRecord.cs
示例3: AttachToConfigurationRecord
internal void AttachToConfigurationRecord(MgmtConfigurationRecord configRecord, FactoryRecord factoryRecord) {
_configRecord = configRecord;
_configKey = factoryRecord.ConfigKey;
_group = factoryRecord.Group;
_name = factoryRecord.Name;
_typeName = factoryRecord.FactoryTypeName;
if (_typeName != null) {
FactoryRecord parentFactoryRecord = null;
if (!configRecord.Parent.IsRootConfig) {
parentFactoryRecord = configRecord.Parent.FindFactoryRecord(factoryRecord.ConfigKey, true);
}
_declarationRequired = (parentFactoryRecord == null || parentFactoryRecord.FactoryTypeName == null);
_declared = configRecord.GetFactoryRecord(factoryRecord.ConfigKey, true) != null;
}
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:17,代码来源:ConfigurationSectionGroup.cs
示例4: AttachToConfigurationRecord
internal void AttachToConfigurationRecord(MgmtConfigurationRecord configRecord, FactoryRecord factoryRecord)
{
this._configRecord = configRecord;
this._configKey = factoryRecord.ConfigKey;
this._group = factoryRecord.Group;
this._name = factoryRecord.Name;
this._typeName = factoryRecord.FactoryTypeName;
if (this._typeName != null)
{
FactoryRecord record = null;
if (!configRecord.Parent.IsRootConfig)
{
record = configRecord.Parent.FindFactoryRecord(factoryRecord.ConfigKey, true);
}
this._declarationRequired = (record == null) || (record.FactoryTypeName == null);
this._declared = configRecord.GetFactoryRecord(factoryRecord.ConfigKey, true) != null;
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:18,代码来源:ConfigurationSectionGroup.cs
示例5: RuntimeConfigurationFactory
internal RuntimeConfigurationFactory(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
{
Init(configRecord, factoryRecord);
}
开发者ID:chcosta,项目名称:corefx,代码行数:4,代码来源:RuntimeConfigurationRecord.cs
示例6: SetRuntimeConfigurationInformation
internal void SetRuntimeConfigurationInformation(BaseConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord) {
_flags[ Flag_Attached ] = true;
// factory info
_configKey = factoryRecord.ConfigKey;
_group = factoryRecord.Group;
_name = factoryRecord.Name;
_typeName = factoryRecord.FactoryTypeName;
_allowDefinition = factoryRecord.AllowDefinition;
_allowExeDefinition = factoryRecord.AllowExeDefinition;
_flags[ Flag_AllowLocation ] = factoryRecord.AllowLocation;
_flags[ Flag_RestartOnExternalChanges ] = factoryRecord.RestartOnExternalChanges;
_flags[ Flag_RequirePermission ] = factoryRecord.RequirePermission;
if (factoryRecord.IsUndeclared) {
_flags[ Flag_IsUndeclared ] = true;
_flags[ Flag_Declared ] = false;
_flags[ Flag_DeclarationRequired ] = false;
}
else {
_flags[ Flag_IsUndeclared ] = false;
_flags[ Flag_Declared ] = configRecord.GetFactoryRecord(factoryRecord.ConfigKey, false) != null;
_flags[ Flag_DeclarationRequired ] = configRecord.IsRootDeclaration(factoryRecord.ConfigKey, false);
}
// section info
_flags[ Flag_LocationLocked ] = sectionRecord.Locked;
if (sectionRecord.HasFileInput) {
SectionInput fileInput = sectionRecord.FileInput;
_flags[ Flag_ProtectionProviderDetermined ] = fileInput.IsProtectionProviderDetermined;
_protectionProvider = fileInput.ProtectionProvider;
SectionXmlInfo sectionXmlInfo = fileInput.SectionXmlInfo;
_configSource = sectionXmlInfo.ConfigSource;
_configSourceStreamName = sectionXmlInfo.ConfigSourceStreamName;
_flags[ Flag_AllowOverride ] = !sectionXmlInfo.LockChildren;
_flags[ Flag_InheritInChildApps ] = !sectionXmlInfo.SkipInChildApps;
_protectionProviderName = sectionXmlInfo.ProtectionProviderName;
}
else {
_flags[ Flag_ProtectionProviderDetermined ] = false;
_protectionProvider = null;
}
// element context information
_configurationSection.AssociateContext( configRecord );
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:50,代码来源:sectioninformation.cs
示例7: CreateSectionGroupFactory
private ConstructorInfo CreateSectionGroupFactory(FactoryRecord factoryRecord)
{
Type type = string.IsNullOrEmpty(factoryRecord.FactoryTypeName)
? typeof(ConfigurationSectionGroup)
: TypeUtil.GetType(Host, factoryRecord.FactoryTypeName, true);
ConstructorInfo ctor = TypeUtil.GetConstructor(type,
typeof(ConfigurationSectionGroup), true);
return ctor;
}
开发者ID:chcosta,项目名称:corefx,代码行数:11,代码来源:MgmtConfigurationRecord.cs
示例8: CreateSectionFactory
// Create the factory that will evaluate configuration
override protected object CreateSectionFactory(FactoryRecord factoryRecord) {
return new RuntimeConfigurationFactory(this, factoryRecord);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:4,代码来源:RuntimeConfigurationRecord.cs
示例9: CreateSectionWithRestrictedPermissions
private object CreateSectionWithRestrictedPermissions(
RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord,
object parentConfig, ConfigXmlReader reader) {
// run configuration section handlers as if user code was on the stack
bool revertPermitOnly = false;
try {
PermissionSet permissionSet = configRecord.GetRestrictedPermissions();
if (permissionSet != null) {
permissionSet.PermitOnly();
revertPermitOnly = true;
}
return CreateSectionImpl(configRecord, factoryRecord, sectionRecord, parentConfig, reader);
}
finally {
if (revertPermitOnly) {
CodeAccessPermission.RevertPermitOnly();
}
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:21,代码来源:RuntimeConfigurationRecord.cs
示例10: CreateSectionImpl
private object CreateSectionImpl(
RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord,
object parentConfig, ConfigXmlReader reader) {
object config;
if (_sectionCtor != null) {
ConfigurationSection configSection = (ConfigurationSection) TypeUtil.InvokeCtorWithReflectionPermission(_sectionCtor);
configSection.SectionInformation.SetRuntimeConfigurationInformation(configRecord, factoryRecord, sectionRecord);
configSection.CallInit();
ConfigurationSection parentSection = (ConfigurationSection) parentConfig;
configSection.Reset(parentSection);
if (reader != null) {
configSection.DeserializeSection(reader);
}
// throw if there are any cached errors
ConfigurationErrorsException errors = configSection.GetErrors();
if (errors != null) {
throw errors;
}
// don't allow changes to sections at runtime
configSection.SetReadOnly();
// reset the modified bit
configSection.ResetModified();
config = configSection;
}
else {
if (reader != null) {
XmlNode xmlNode = ErrorInfoXmlDocument.CreateSectionXmlNode(reader);
CheckForLockAttributes(factoryRecord.ConfigKey, xmlNode);
// In v1, our old section handler expects a context that contains the virtualPath from the configPath
object configContext = configRecord.Host.CreateDeprecatedConfigContext(configRecord.ConfigPath);
config = _sectionHandler.Create(parentConfig, configContext, xmlNode);
}
else {
config = null;
}
}
return config;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:52,代码来源:RuntimeConfigurationRecord.cs
示例11: InitWithFullTrust
private void InitWithFullTrust(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord) {
Init(configRecord, factoryRecord);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:3,代码来源:RuntimeConfigurationRecord.cs
示例12: GetUpdatedSectionGroupDeclarationXml
private string GetUpdatedSectionGroupDeclarationXml(FactoryRecord factoryRecord, ConfigurationSectionGroup configSectionGroup) {
if (TargetFramework != null && !configSectionGroup.ShouldSerializeSectionGroupInTargetVersion(TargetFramework))
return null;
StringBuilder sb = new StringBuilder();
sb.Append('<');
sb.Append(KEYWORD_SECTIONGROUP);
sb.Append(' ');
AppendAttribute(sb, KEYWORD_SECTIONGROUP_NAME, configSectionGroup.Name);
string type = (configSectionGroup.Type != null) ? configSectionGroup.Type : factoryRecord.FactoryTypeName;
if (TypeStringTransformerIsSet)
type = TypeStringTransformer(type);
AppendAttribute(sb, KEYWORD_SECTIONGROUP_TYPE, type);
sb.Append('>');
return sb.ToString();
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:19,代码来源:MgmtConfigurationRecord.cs
示例13: GetUpdatedSectionDeclarationXml
private string GetUpdatedSectionDeclarationXml(FactoryRecord factoryRecord, ConfigurationSection configSection, ConfigurationSaveMode saveMode) {
StringBuilder sb = new StringBuilder();
sb.Append('<');
sb.Append(KEYWORD_SECTION);
sb.Append(' ');
string type = (configSection.SectionInformation.Type != null) ? configSection.SectionInformation.Type : factoryRecord.FactoryTypeName;
if (TypeStringTransformerIsSet)
type = TypeStringTransformer(type);
AppendAttribute(sb, KEYWORD_SECTION_NAME, configSection.SectionInformation.Name);
AppendAttribute(sb, KEYWORD_SECTION_TYPE, type);
if ( !configSection.SectionInformation.AllowLocation ||
(saveMode == ConfigurationSaveMode.Full) ||
((saveMode == ConfigurationSaveMode.Modified) &&
configSection.SectionInformation.AllowLocationModified)) {
AppendAttribute(sb,
KEYWORD_SECTION_ALLOWLOCATION,
configSection.SectionInformation.AllowLocation ?
KEYWORD_TRUE :
KEYWORD_FALSE);
}
if ((configSection.SectionInformation.AllowDefinition != ConfigurationAllowDefinition.Everywhere) ||
(saveMode == ConfigurationSaveMode.Full) ||
(saveMode == ConfigurationSaveMode.Modified && configSection.SectionInformation.AllowDefinitionModified)) {
string v = null;
switch (configSection.SectionInformation.AllowDefinition) {
case ConfigurationAllowDefinition.Everywhere:
v = KEYWORD_SECTION_ALLOWDEFINITION_EVERYWHERE;
break;
case ConfigurationAllowDefinition.MachineOnly:
v = KEYWORD_SECTION_ALLOWDEFINITION_MACHINEONLY;
break;
case ConfigurationAllowDefinition.MachineToWebRoot:
v = KEYWORD_SECTION_ALLOWDEFINITION_MACHINETOWEBROOT;
break;
case ConfigurationAllowDefinition.MachineToApplication:
v = KEYWORD_SECTION_ALLOWDEFINITION_MACHINETOAPPLICATION;
break;
}
AppendAttribute(sb, KEYWORD_SECTION_ALLOWDEFINITION, v);
}
if ((configSection.SectionInformation.AllowExeDefinition !=
ConfigurationAllowExeDefinition.MachineToApplication ) ||
(saveMode == ConfigurationSaveMode.Full) ||
(saveMode == ConfigurationSaveMode.Modified && configSection.SectionInformation.AllowExeDefinitionModified)) {
AppendAttribute( sb,
KEYWORD_SECTION_ALLOWEXEDEFINITION,
ExeDefinitionToString(
configSection.SectionInformation.AllowExeDefinition )
);
}
if ( (configSection.SectionInformation.OverrideModeDefaultSetting.IsDefaultForSection == false) ||
(saveMode == ConfigurationSaveMode.Full) ||
(saveMode == ConfigurationSaveMode.Modified && configSection.SectionInformation.OverrideModeDefaultModified)) {
AppendAttribute( sb,
KEYWORD_SECTION_OVERRIDEMODEDEFAULT,
configSection.SectionInformation.OverrideModeDefaultSetting.OverrideModeXmlValue);
}
if (!configSection.SectionInformation.RestartOnExternalChanges) {
AppendAttribute(sb, KEYWORD_SECTION_RESTARTONEXTERNALCHANGES, KEYWORD_FALSE);
}
else if ((saveMode == ConfigurationSaveMode.Full) ||
(saveMode == ConfigurationSaveMode.Modified && configSection.SectionInformation.RestartOnExternalChangesModified)) {
AppendAttribute(sb, KEYWORD_SECTION_RESTARTONEXTERNALCHANGES, KEYWORD_TRUE);
}
if (!configSection.SectionInformation.RequirePermission) {
AppendAttribute(sb, KEYWORD_SECTION_REQUIREPERMISSION, KEYWORD_FALSE);
}
else if ((saveMode == ConfigurationSaveMode.Full) ||
(saveMode == ConfigurationSaveMode.Modified && configSection.SectionInformation.RequirePermissionModified)) {
AppendAttribute(sb, KEYWORD_SECTION_REQUIREPERMISSION, KEYWORD_TRUE);
}
sb.Append("/>");
return sb.ToString();
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:89,代码来源:MgmtConfigurationRecord.cs
示例14: AreDeclarationAttributesModified
private bool AreDeclarationAttributesModified(FactoryRecord factoryRecord, ConfigurationSection configSection) {
return factoryRecord.FactoryTypeName != configSection.SectionInformation.Type
|| factoryRecord.AllowLocation != configSection.SectionInformation.AllowLocation
|| factoryRecord.RestartOnExternalChanges != configSection.SectionInformation.RestartOnExternalChanges
|| factoryRecord.RequirePermission != configSection.SectionInformation.RequirePermission
|| factoryRecord.AllowDefinition != configSection.SectionInformation.AllowDefinition
|| factoryRecord.AllowExeDefinition != configSection.SectionInformation.AllowExeDefinition
|| factoryRecord.OverrideModeDefault.OverrideMode != configSection.SectionInformation.OverrideModeDefaultSetting.OverrideMode // Compare the value only
|| configSection.SectionInformation.IsModifiedFlags();
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:10,代码来源:MgmtConfigurationRecord.cs
示例15: CreateSectionFactory
//
// Create the factory object that is used to create new instances of a ConfigurationSection.
// Our factory is a ConstructorInfo that creates the section.
//
override protected object CreateSectionFactory(FactoryRecord factoryRecord) {
// Get the type of the factory
Type type = TypeUtil.GetTypeWithReflectionPermission(Host, factoryRecord.FactoryTypeName, true);
//
// If the type is not a ConfigurationSection, use the DefaultSection if the type
// implements IConfigurationSectionHandler.
//
if (!typeof(ConfigurationSection).IsAssignableFrom(type)) {
TypeUtil.VerifyAssignableType(typeof(IConfigurationSectionHandler), type, true);
type = typeof(DefaultSection);
}
ConstructorInfo ctor = TypeUtil.GetConstructorWithReflectionPermission(type, typeof(ConfigurationSection), true);
return ctor;
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:22,代码来源:MgmtConfigurationRecord.cs
示例16: InitWithRestrictedPermissions
private void InitWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
{
Init(configRecord, factoryRecord);
}
开发者ID:kichalla,项目名称:systemconfigurationport,代码行数:4,代码来源:RuntimeConfigurationRecord.cs
示例17: CreateSectionWithRestrictedPermissions
private object CreateSectionWithRestrictedPermissions(
RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord,
object parentConfig, ConfigXmlReader reader)
{
return CreateSectionImpl(configRecord, factoryRecord, sectionRecord, parentConfig, reader);
}
开发者ID:kichalla,项目名称:systemconfigurationport,代码行数:6,代码来源:RuntimeConfigurationRecord.cs
示例18: RuntimeConfigurationFactory
internal RuntimeConfigurationFactory(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord) {
// If the factory record was defined in a trusted config record, ignore user code on stack
if (factoryRecord.IsFromTrustedConfigRecord) {
InitWithFullTrust(configRecord, factoryRecord);
}
else {
// Run configuration section handlers as if user code was on the stack
InitWithRestrictedPermissions(configRecord, factoryRecord);
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:RuntimeConfigurationRecord.cs
示例19: Init
private void Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord) {
// Get the type of the factory
Type type = TypeUtil.GetTypeWithReflectionPermission(configRecord.Host, factoryRecord.FactoryTypeName, true);
// If the type is a ConfigurationSection, that's the type.
if (typeof(ConfigurationSection).IsAssignableFrom(type)) {
_sectionCtor = TypeUtil.GetConstructorWithReflectionPermission(type, typeof(ConfigurationSection), true);
}
else {
// Note: in v1, IConfigurationSectionHandler is in effect a factory that has a Create method
// that creates the real section object.
// throws if type does not implement IConfigurationSectionHandler
TypeUtil.VerifyAssignableType(typeof(IConfigurationSectionHandler), type, true);
// Create an instance of the handler
_sectionHandler = (IConfigurationSectionHandler) TypeUtil.CreateInstanceWithReflectionPermission(type);
}
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:19,代码来源:RuntimeConfigurationRecord.cs
示例20: CreateSection
//
// Create the ConfigurationSection.
//
override protected object CreateSection(bool inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, object parentConfig, ConfigXmlReader reader) {
// Create an instance of the ConfigurationSection
ConstructorInfo ctor = (ConstructorInfo) factoryRecord.Factory;
ConfigurationSection configSection = (ConfigurationSection) TypeUtil.InvokeCtorWithReflectionPermission(ctor);
// Attach the ConfigurationSection to this record
configSection.SectionInformation.AttachToConfigurationRecord(this, factoryRecord, sectionRecord);
configSection.CallInit();
// Initialize the ConfigurationSection with XML or just its parent.
ConfigurationSection parentConfigSection = (ConfigurationSection) parentConfig;
configSection.Reset(parentConfigSection);
if (reader != null) {
configSection.DeserializeSection(reader);
}
// Clear the modified bit.
configSection.ResetModified();
return configSection;
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:24,代码来源:MgmtConfigurationRecord.cs
注:本文中的System.Configuration.FactoryRecord类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论