/// <summary> /// Returns an existing server node or creates a new one /// </summary> public ServerNode this[Glue.Node node] { get { EnsureObjectNotDisposed(); return(m_Servers.GetOrRegister(node.Name, (n) => new ServerNode(this, n), node)); } }
/// <summary> /// Returns an existing server node or creates a new one. /// If the node binding is `appliance://(name)` then delegates the server resolution /// to a optionally named appliance which is a module of type IMongoDbAppliance loaded on app chassis /// </summary> public ServerNode this[Glue.Node node] { get { EnsureObjectNotDisposed(); if (node.Binding.EqualsOrdIgnoreCase(APPLIANCE_BINDING)) { //lookup local appliance and take effective address from there var name = node.Host; var appliance = name.IsNotNullOrWhiteSpace() ? App.ModuleRoot.Get <IMongoDbAppliance>(name) : App.ModuleRoot.Get <IMongoDbAppliance>(); var effectiveNode = appliance.EffectiveServerNode; return(m_Servers.GetOrRegister(effectiveNode.Name, (nodes) => new ServerNode(this, nodes.n, nodes.a), (n: effectiveNode, a: node))); } return(m_Servers.GetOrRegister(node.Name, (n) => new ServerNode(this, n, new Glue.Node()), node)); } }
/// <summary> /// Returns an existing server node or creates a new one. /// If the node binding is `appliance://(name)` then delegates the server resolution /// to a optionally named appliance which is a module of type IMongoDbAppliance loaded on app chassis /// </summary> public ServerNode this[Glue.Node node] { get { EnsureObjectNotDisposed(); if (node.Binding.EqualsOrdIgnoreCase(APPLIANCE_BINDING)) { //lookup local appliance and take effective address from there var name = node.Host; var appliance = name.IsNotNullOrWhiteSpace() ? App.ModuleRoot.Get <IMongoDbAppliance>(name) : App.ModuleRoot.Get <IMongoDbAppliance>(); var effectiveNode = appliance.EffectiveServerNode; return(m_Servers.GetOrRegister(effectiveNode.Name, (nodes) => new ServerNode(this, nodes.n, nodes.a), (n: effectiveNode, a: node))); } if (node.Binding.EqualsOrdIgnoreCase(MONGO_BINDING)) { return(m_Servers.GetOrRegister(node.Name, (n) => new ServerNode(this, n, new Glue.Node()), node)); } throw new MongoDbConnectorException(StringConsts.BAD_BINDING_ERROR.Args(node.Binding.TakeFirstChars(32), MONGO_BINDING, APPLIANCE_BINDING)); } }