/// <summary> /// Verifies whether or not the specified extension type exists in the extension collection. If not found, an instance of the <see cref="CloudApplicationException"/> /// will be thrown. /// </summary> /// <typeparam name="T">The type of the extension. Must implement <see cref="System.ServiceModel.IExtension<T>"/> as prescribed by the extension model.</typeparam> /// <param name="collection">The instance of the object implementing the <see cref="System.ServiceModel.IExtensionCollection<T>"/> interface.</param> public static void Demand <T>(this IExtensionCollection <IExtensibleCloudServiceComponent> collection) where T : ICloudServiceComponentExtension { if (null == collection || null == collection.Find <T>()) { throw new CloudApplicationException(String.Format(CultureInfo.CurrentCulture, ExceptionMessages.ExtensionObjectNotFound, typeof(T).Name)); } }
/// <summary> /// Adds a sequence of extension objects to an extension collection. /// </summary> /// <param name="this">The extension collection to which to add the extensions.</param> /// <param name="extensions">The sequence of extension objects to add to the extension collection.</param> public static void AddRange(this IExtensionCollection @this, IEnumerable <IExtension> extensions) { foreach (var extension in extensions) { @this.Add(extension); } }
public TypeConfigurations(IExtensionCollection extensions, IDictionary <TypeInfo, string> names, ConcurrentDictionary <TypeInfo, ITypeConfiguration> store) : base(store) { _extensions = extensions; _names = names; _store = store; }
/// <summary> /// Removes all extension objects from this collection and moves them to a new collection. /// </summary> /// <param name="from">The extension collection from which to remove the extensions.</param> /// <param name="to">The extension collection to which to add the extensions.</param> public static void MoveAllExtensionsTo(this IExtensionCollection from, IExtensionCollection to) { var list = from.ToList(); from.Clear(); to.AddRange(list); }
public RootContext(ITypeConfigurations types, IExtensionCollection extensions, IServicesFactory factory) { Types = types; _extensions = extensions; _factory = factory; _extensions.Add(new RootContextExtension(this)); }
public void T2_Tests() { IExtensionCollection <GraphObject, IExtension <GraphObject> > exts = _context.Extensions; ArborNode node = new ArborNode(""); exts.Add(node); Assert.IsTrue(exts.Contains(node)); Assert.AreEqual(1, exts.Count); IExtension <GraphObject> xt = exts.Find <ArborNode>(); Assert.IsNotNull(xt); Assert.IsTrue(xt is ArborNode); Assert.AreEqual(node, xt); // Assert.IsTrue(exts.Remove(node)); Assert.IsFalse(exts.Contains(node)); Assert.AreEqual(0, exts.Count); // exts.Add(node); ArborNode node1 = new ArborNode(""); exts.Add(node1); Assert.IsTrue(exts.Contains(node)); Assert.IsTrue(exts.Contains(node1)); Assert.AreEqual(2, exts.Count); Collection <ArborNode> cols = exts.FindAll <ArborNode>(); Assert.AreEqual(2, cols.Count); Assert.IsTrue(exts.Remove(node)); Assert.IsFalse(exts.Contains(node)); Assert.IsTrue(exts.Contains(node1)); Assert.AreEqual(1, exts.Count); // exts.Add(node); // adding second node, but internal array was length=2 // exts.Clear(); Assert.AreEqual(0, exts.Count); // Assert.IsFalse(exts.Remove(null)); Assert.Throws(typeof(ArgumentNullException), () => { exts.Add(null); }); Assert.Throws(typeof(ArgumentNullException), () => { new ExtensionCollection <GraphObject, IExtension <GraphObject> >(null); }); }
public static void Snippet4() { // <Snippet4> Uri baseAddress = new Uri("http://localhost:8000/ServiceModelSamples/service"); CalculatorService service = new CalculatorService(); ServiceHost serviceHost = new ServiceHost(service, baseAddress); InstanceContext instanceContext = new InstanceContext(serviceHost, service); IExtensionCollection <InstanceContext> extensions = instanceContext.Extensions; // </Snippet4> }
private WcfOperationContextStorageExtension <T> GetWcfStorageExtension() { Fail.IfNull(OperationContext.Current, "There is no WCF " + nameof(OperationContext) + " available"); IExtensionCollection <OperationContext> extensions = OperationContext.Current.Extensions; var instance = extensions.Find <WcfOperationContextStorageExtension <T> >(); if (instance == null) { instance = new WcfOperationContextStorageExtension <T>(); extensions.Add(instance); } return(instance); }
// Constructors internal Domain(DomainConfiguration configuration, object upgradeContextCookie, SqlConnection singleConnection, DefaultSchemaInfo defaultSchemaInfo) { Configuration = configuration; Handlers = new HandlerAccessor(this); GenericKeyFactories = new ConcurrentDictionary <TypeInfo, GenericKeyFactory>(); RecordSetReader = new RecordSetReader(this); KeyGenerators = new KeyGeneratorRegistry(); PrefetchFieldDescriptorCache = new ConcurrentDictionary <TypeInfo, ReadOnlyList <PrefetchFieldDescriptor> >(); KeyCache = new LruCache <Key, Key>(Configuration.KeyCacheSize, k => k); QueryCache = new LruCache <object, Pair <object, TranslatedQuery> >(Configuration.QueryCacheSize, k => k.First); PrefetchActionMap = new Dictionary <TypeInfo, Action <SessionHandler, IEnumerable <Key> > >(); Extensions = new ExtensionCollection(); UpgradeContextCookie = upgradeContextCookie; SingleConnection = singleConnection; StorageNodeManager = new StorageNodeManager(Handlers); }
// Constructors internal Domain(DomainConfiguration configuration, object upgradeContextCookie, SqlConnection singleConnection) { Configuration = configuration; Handlers = new HandlerAccessor(this); GenericKeyFactories = new ConcurrentDictionary <TypeInfo, GenericKeyFactory>(); EntityDataReader = new EntityDataReader(this); KeyGenerators = new KeyGeneratorRegistry(); PrefetchFieldDescriptorCache = new ConcurrentDictionary <TypeInfo, ReadOnlyList <PrefetchFieldDescriptor> >(); KeyCache = new LruCache <Key, Key>(Configuration.KeyCacheSize, k => k); QueryCache = new FastConcurrentLruCache <object, Pair <object, ParameterizedQuery> >(Configuration.QueryCacheSize, k => k.First); PrefetchActionMap = new Dictionary <TypeInfo, Action <SessionHandler, IEnumerable <Key> > >(); Extensions = new ExtensionCollection(); UpgradeContextCookie = upgradeContextCookie; SingleConnection = singleConnection; StorageNodeManager = new StorageNodeManager(Handlers); isDebugEventLoggingEnabled = OrmLog.IsLogged(LogLevel.Debug); // Just to cache this value }
public IServices Get(IExtensionCollection parameter) { var result = new Services(new ServiceContainer(_options) { ConstructorSelector = _selector }); var services = result.RegisterInstance(parameter) .RegisterInstance <IServiceProvider>(new Provider(result.GetService)); var extensions = parameter.OrderBy(x => x, SortComparer <ISerializerExtension> .Default) .Fixed(); extensions.Alter(services); foreach (var extension in extensions) { extension.Execute(result); } return(result); }
/// <summary> /// Initializes new instance of this type. /// </summary> /// <param name="source">The source to copy into this collection.</param> public ExtensionCollection(IExtensionCollection source) : this() { ArgumentValidator.EnsureArgumentNotNull(source, "source"); if (source.Count == 0) { return; } var sourceLikeMe = source as ExtensionCollection; if (sourceLikeMe != null) { extensions = new Dictionary <Type, object>(sourceLikeMe.extensions); } else { foreach (Type extensionType in source) { Set(extensionType, source.Get(extensionType)); } } }
public ExtensionCollection(IExtensionCollection <T> defaults) { _defaults = defaults; }
public ExtensibleBehavior() { extensions = new ExtensionCollection <ExtensibleBehavior>(this); }
public TypeConfigurations(IExtensionCollection extensions) : this(extensions, extensions.Find <TypeNamesExtension>() .Names, new ConcurrentDictionary <TypeInfo, ITypeConfiguration>()) { }
private void JustDecompileGenerated_set_Extensions(IExtensionCollection <TransactionResult> value) { this.JustDecompileGenerated_Extensions_k__BackingField = value; }
protected GraphObject() { fExtensions = new ExtensionCollection <GraphObject, IExtension <GraphObject> >(this); }
public void T1_Tests() { IExtensionCollection <GraphObject, IExtension <GraphObject> > exts = _context.Extensions; Assert.IsNotNull(exts); }
public RootContext(ITypeConfigurations types, IExtensionCollection extensions) : this(types, extensions, ServicesFactory .Default) { }
public RootContext(IExtensionCollection extensions) : this(new TypeConfigurations(extensions), extensions) { }
/// <inheritdoc /> public ConfigurationContainer(IExtensionCollection extensions) : this(new RootContext(extensions)) { }
public OperationContextExtensionCollectionWrap(IExtensionCollection <OperationContext> underlyingObject) { UnderlyingObject = underlyingObject; }