本文整理汇总了C#中IActivator类的典型用法代码示例。如果您正苦于以下问题:C# IActivator类的具体用法?C# IActivator怎么用?C# IActivator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IActivator类属于命名空间,在下文中一共展示了IActivator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Bootstrapper
public Bootstrapper(IAssemblyLoader assemblyLoader, IModuleLoader moduleLoader, IActivator activator, IModuleImporter moduleImporter)
{
this.assemblyLoader = assemblyLoader;
this.moduleLoader = moduleLoader;
this.activator = activator;
this.moduleImporter = moduleImporter;
}
示例2: RyuContainer
public RyuContainer(
RyuContainer parent,
IActivator activator
)
: this(parent, activator, new ConcurrentDictionary<Type, RyuType>())
{
}
示例3: Create
// single layer network
public static NeuralNetwork<Vector> Create(IDataSet<Vector, Vector> dataSet, IActivator activator)
{
var workLayer = new FullyConnectedLayer(dataSet.FirstInput.Size, dataSet.FirstOutput.Size, activator);
var outputLayer = new OutputLayer<Vector>();
var layers = new CompositeLayer<Vector, Vector, Vector>(workLayer, outputLayer);
return new NeuralNetwork<Vector>(layers);
}
示例4: AppDomainLevelActivator
internal AppDomainLevelActivator(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException("info");
}
this.m_NextActivator = (IActivator) info.GetValue("m_NextActivator", typeof(IActivator));
}
示例5: DynamicProxyActivator
public DynamicProxyActivator(IMachineContainer container, IProxyBuilder proxyBuilder, IActivator target, ServiceEntry entry)
{
_container = container;
_entry = entry;
_proxyBuilder = proxyBuilder;
_target = target;
_proxyGenerator = new ProxyGenerator(_proxyBuilder);
}
示例6: Bind
public virtual void Bind(IActivator activator)
{
if (_activator != null && activator != null && _activator != activator)
{
throw new InvalidOperationException();
}
_activator = activator;
}
示例7: BottleService
public BottleService(IActivator activator, IPackageLog log)
{
_activator = activator;
_log = log;
if(!IsBottleService(activator))
{
throw new ArgumentException("Activator must also implement {0}".ToFormat(typeof(IDeactivator).Name), "activator");
}
}
示例8: SubstituteTypeExpressionVisitor
/// <summary>
/// Initializes a new instance of the <see cref="SubstituteTypeExpressionVisitor"/> class.
/// </summary>
/// <param name="activator">The activator.</param>
public SubstituteTypeExpressionVisitor(IActivator activator)
: this(
activator,
new ISubstituteTypeConstantHandler[]
{
new ListSubstituteTypeConstantHandler(),
new EnumerableQuerySubstituteTypeConstantHandler(),
new DataContextQueryableSubstituteTypeConstantHandler(),
})
{
}
示例9: Init
/// <inheritdoc/>
public virtual void Init(IActivator activator, IKernel kernel, IComponentInfo info, Action<IComponentInfo, object> onDestroying, Action<IComponentContext> onFetch)
{
Guard.NotNull(activator, "activator");
Guard.NotNull(kernel, "kernel");
Guard.NotNull(info, "info");
this.Activator = activator;
this.Kernel = kernel;
this.Info = info;
OnDestroying = onDestroying;
OnFetch = onFetch;
}
示例10: Bind
public void Bind(IActivator activator)
{
if (_activator == activator)
{
return;
}
if (activator != null && null != _activator)
{
throw new System.InvalidOperationException();
}
_activator = activator;
}
示例11: Bind
public void Bind(IActivator activator)
{
if (this.activator == activator)
{
return;
}
if (activator != null && null != this.activator)
{
throw new InvalidOperationException("Object can only be bound to one activator");
}
this.activator = activator;
}
示例12: Bind
public virtual void Bind(IActivator activator)
{
if (this._activator == activator)
{
return;
}
if (activator != null && this._activator != null)
{
throw new InvalidOperationException();
}
this._activator = activator;
}
示例13: Bind
public virtual void Bind(IActivator activator)
{
if (_activator == activator)
{
return;
}
if (_activator != null && activator != null)
{
throw new Exception();
}
_activator = activator;
}
示例14: AddActivator
public void AddActivator(ServiceEntry entry, IActivator activator)
{
using (RWLock.AsWriter(_lock))
{
if (_cache.ContainsKey(entry))
{
throw new ServiceContainerException("Multiple activators for one entry!");
}
_log.Info("Adding: " + entry + " " + activator);
_cache[entry] = activator;
}
}
示例15: DecryptElement
public static XElement DecryptElement(this XElement element, IActivator activator)
{
// If no decryption necessary, return original element.
if (!DoesElementOrDescendentRequireDecryption(element))
{
return element;
}
// Deep copy the element (since we're going to mutate) and put
// it into a document to guarantee it has a parent.
var doc = new XDocument(new XElement(element));
// We remove elements from the document as we decrypt them and perform
// fix-up later. This keeps us from going into an infinite loop in
// the case of a null decryptor (which returns its original input which
// is still marked as 'requires decryption').
var placeholderReplacements = new Dictionary<XElement, XElement>();
while (true)
{
var elementWhichRequiresDecryption = doc.Descendants(XmlConstants.EncryptedSecretElementName).FirstOrDefault();
if (elementWhichRequiresDecryption == null)
{
// All encryption is finished.
break;
}
// Decrypt the clone so that the decryptor doesn't inadvertently modify
// the original document or other data structures. The element we pass to
// the decryptor should be the child of the 'encryptedSecret' element.
var clonedElementWhichRequiresDecryption = new XElement(elementWhichRequiresDecryption);
var innerDoc = new XDocument(clonedElementWhichRequiresDecryption);
string decryptorTypeName = (string)clonedElementWhichRequiresDecryption.Attribute(XmlConstants.DecryptorTypeAttributeName);
var decryptorInstance = activator.CreateInstance<IXmlDecryptor>(decryptorTypeName);
var decryptedElement = decryptorInstance.Decrypt(clonedElementWhichRequiresDecryption.Elements().Single());
// Put a placeholder into the original document so that we can continue our
// search for elements which need to be decrypted.
var newPlaceholder = new XElement("placeholder");
placeholderReplacements[newPlaceholder] = decryptedElement;
elementWhichRequiresDecryption.ReplaceWith(newPlaceholder);
}
// Finally, perform fixup.
Debug.Assert(placeholderReplacements.Count > 0);
foreach (var entry in placeholderReplacements)
{
entry.Key.ReplaceWith(entry.Value);
}
return doc.Root;
}