public JoinClause(ObjectReference table, JoinType joinType, SimpleExpression joinExpression) { if (table == null) throw new ArgumentNullException("table"); _table = table; _joinType = joinType; _joinExpression = joinExpression; }
public UnmarshallingContext(Transaction transaction, ByteArrayBuffer buffer, ObjectReference @ref, int addToIDTree, bool checkIDTree) : base(transaction, buffer, null, @ref ) { _addToIDTree = addToIDTree; _checkIDTree = checkIDTree; }
public void IdResolutionGet() { var itemInfo = TestItems.Item(ItemCode.MissileLauncher); var idResolution = new IdResolutionContext(new[] { itemInfo, }); var objRef = new ObjectReference(itemInfo.ObjectId); idResolution.Get<ItemInfo>(objRef); }
private SimpleExpression InferJoinExpression(ObjectReference table) { if (table.GetOwner().IsNull()) return null; var table1 = _schema.FindTable(table.GetOwner().GetName()); var table2 = _schema.FindTable(table.GetName()); var foreignKey = GetForeignKey(table1, table2); return MakeJoinExpression(table, foreignKey); }
public void ObjectReferenceTest() { var reference = new ObjectReference<Person>(() => new Person()); Assert.IsFalse(reference.HasTarget); var target = reference.Target; Assert.IsTrue(reference.HasTarget); }
private Column GetColumn(ObjectReference reference) { if (ReferenceEquals(reference, null)) { return null; } var table = _schema.FindTable(reference.GetOwner().ToString()); return table.FindColumn(reference.GetName()); }
private static Func<XElement, XElement> BuildElementResolver(ObjectReference reference) { var elementNames = reference.GetAllObjectNames(); if (elementNames.Length == 2) { return xml => xml; } return BuildNestedElementResolver(elementNames); }
public void IdResolutionFail() { const long id = 1L; var itemInfo = TestItems.Item(ItemCode.MissileLauncher); var idResolution = new IdResolutionContext(new[] { itemInfo, }); var objRef = new ObjectReference(id); Should.Throw<ItemNotFoundException>(() => idResolution.Get<ItemInfo>(objRef)).Message.ShouldBe("Could not find ItemInfo \"[x00000001]\""); Should.Throw<ItemNotFoundException>(() => idResolution.GetById<ItemInfo>(id)).Message.ShouldBe("Could not find ItemInfo \"1\""); }
public static SimpleExpression CriteriaDictionaryToExpression(ObjectReference table, IEnumerable<KeyValuePair<string, object>> dictionary) { if (dictionary.Count() == 1) { return CriteriaPairToExpression(table, dictionary.Single()); } return new SimpleExpression(CriteriaPairToExpression(table, dictionary.First()), CriteriaDictionaryToExpression(table, dictionary.Skip(1)), SimpleExpressionType.And); }
public static SimpleExpression CriteriaDictionaryToExpression(ObjectReference table, IEnumerable<KeyValuePair<string, object>> dictionary) { var list = dictionary.ToList(); if (list.Count == 1) { return CriteriaPairToExpression(table, list[0]); } return new SimpleExpression(CriteriaPairToExpression(table, list[0]), CriteriaDictionaryToExpression(table, list.Skip(1)), SimpleExpressionType.And); }
public void DisposeTest() { var reference = new ObjectReference<Person>(() => new Person()); reference.Disposed += Reference_Disposed; Assert.IsFalse(reference.HasTarget); Assert.IsFalse(reference.IsDisposed); reference.Dispose(); Assert.IsTrue(reference.IsDisposed); var target = reference.Target; }
public int GetId(object obj) { var reference = new ObjectReference(obj); int id; if (objToId.TryGetValue(reference, out id)) { return id; } else { var new_id = AllocateId(); objToId.Add(reference, new_id); return new_id; } }
public override IDictionary<string, object> Get(string tableName, params object[] keyValues) { if (!_keyColumns.ContainsKey(tableName)) throw new InvalidOperationException("No key specified for In-Memory table."); var keys = _keyColumns[tableName]; if (keys.Length != keyValues.Length) throw new ArgumentException("Incorrect number of values for key."); var expression = new ObjectReference(keys[0]) == keyValues[0]; for (int i = 1; i < keyValues.Length; i++) { expression = expression && new ObjectReference(keys[i]) == keyValues[i]; } return Find(tableName, expression).FirstOrDefault(); }
public MarshallingContext(Transaction trans, ObjectReference @ref, IUpdateDepth updateDepth, bool isNew) { // YapClass ID // Marshaller Version // number of fields _transaction = trans; _reference = @ref; _nullBitMap = new BitMap4(AspectCount()); _updateDepth = ClassMetadata().AdjustUpdateDepth(trans, updateDepth); _isNew = isNew; _writeBuffer = new MarshallingBuffer(); _currentBuffer = _writeBuffer; }
public virtual async Task<Paged<Entities.Url>> GetResult(Filter.Simple.Data.Filter filter, int? accountId = null) { filter.Resource = "Urls"; DataStrategy strategy = Database.Open(); var query = new SimpleQuery(strategy, filter.Resource); var limit = _limit.Apply(filter); var skip = _skip.Apply(filter); dynamic accounts; query = query.Join(ObjectReference.FromString("Accounts"), JoinType.Inner, out accounts) .On(accounts.Id == new ObjectReference("AccountId", ObjectReference.FromString("Urls"))) .Select( new ObjectReference("Id", ObjectReference.FromString("Urls")), new ObjectReference("Address", ObjectReference.FromString("Urls")), new ObjectReference("Id", ObjectReference.FromString("Accounts")).As("Account_Id")) .Skip(_skip.Apply(filter)) .Take(_limit.Apply(filter)); if (accountId.HasValue) { var leftOperand = new ObjectReference("AccountId", ObjectReference.FromString("Urls")); query.Where(new SimpleExpression(leftOperand, accountId, SimpleExpressionType.Equal)); } if (filter.HasOrdering) { query = query.OrderBy(_order.Apply(filter), OrderByDirection.Ascending); } var data = await query.ToList<dynamic>(); var entities = AutoMapper.MapDynamic<Entities.Url>(data).ToList(); if (!entities.Any()) { return null; } return new Paged<Entities.Url> { Limit = limit, Skip = skip, Data = entities }; }
public virtual void RemoveReference(ObjectReference @ref) { if (DTrace.enabled) { DTrace.ReferenceRemoved.Log(@ref.GetID()); } if (_hashCodeTree != null) { _hashCodeTree = _hashCodeTree.Hc_remove(@ref); } if (_idTree != null) { _idTree = _idTree.Id_remove(@ref); } }
public void ObjectReferenceEquality() { var o1 = new ObjectReference(10, "Bob"); var o2 = new ObjectReference(10, "Fred"); var o3 = new ObjectReference(10); var o4 = new ObjectReference(11); Assert.That(o1, Is.EqualTo(o2).And.EqualTo(o3)); Assert.That(o1.GetHashCode(), Is.EqualTo(o2.GetHashCode()).And.EqualTo(o3.GetHashCode())); Assert.That(o1.Equals(o3), Is.True); Assert.That(o1.Equals(o4), Is.False); Assert.That(o1 == o3, Is.True); Assert.That(o1 != o4, Is.True); Assert.That(o1.Equals("not an object"), Is.False); }
public void IdResolutionCombine() { var i1 = TestItems.Item(ItemCode.MissileLauncher); var i2 = TestItems.Item(ItemCode.EnergyShield); var r1 = new IdResolutionContext(new[] { i1, }); var r2 = new IdResolutionContext(new[] { i2, }); var idResolution = r1.Combine(r2); idResolution.ShouldBeOfType<CompositeIdResolver>(); var objRef = new ObjectReference(i2.ObjectId); idResolution.Get<ItemInfo>(objRef); idResolution.Values.ShouldContain(i1); idResolution.Values.ShouldContain(i2); }
public void SelectShouldRestrictColumnList() { var tableRef = new ObjectReference("FooTable"); var selectClause = new SelectClause(new SimpleReference[] { new ObjectReference("Id", tableRef), new ObjectReference("Name", tableRef) }); var runner = new DictionaryQueryRunner(SelectSource(), selectClause); var actual = runner.Run().ToList(); Assert.AreEqual(4, actual.Count); Assert.AreEqual(2, actual[0].Count); Assert.AreEqual(1, actual[0]["Id"]); Assert.AreEqual("Alice", actual[0]["Name"]); Assert.AreEqual(2, actual[1].Count); Assert.AreEqual(2, actual[1]["Id"]); Assert.AreEqual("Bob", actual[1]["Name"]); Assert.AreEqual(2, actual[2].Count); Assert.AreEqual(3, actual[2]["Id"]); Assert.AreEqual("Charlie", actual[2]["Name"]); Assert.AreEqual(2, actual[3].Count); Assert.AreEqual(4, actual[3]["Id"]); Assert.AreEqual("David", actual[3]["Name"]); }
public _IReferenceSource_33(ObjectReference reference) { this.reference = reference; }
public void Serilazed_Details_Object_With_ObjectTreeNode_Exists() { // arrange var scenario = new Scenario { Name = ScenarioName, Description = "a scenario for testing trees in details", Status = "failed" }; // A tree containing most important item types that need to be supported // (same types are allowed for items in tree nodes as for values in Details --> reuse code from // SerializableDictionary!). // Root node with string as item var rootNode = new ObjectTreeNode <object> { Item = "Root" }; rootNode.AddDetail( "detailKey", "Tree nodes can have again details, use same serialization as already tested!"); // node one with object description as item var childWithObject = new ObjectTreeNode <object>(); var objDescription = new ObjectDescription("serviceCall", "AddressWebService.getAdress"); objDescription.AddDetail("justADetail", "just an example"); childWithObject.Item = objDescription; rootNode.AddChild(childWithObject); // node two with object reference as item var childWithObjectRef = new ObjectTreeNode <object>(); var objRef = new ObjectReference("serviceCall", "AddressWebService.getAdress"); childWithObjectRef.Item = objRef; rootNode.AddChild(childWithObjectRef); // node three with List of Strings as item var childWithList = new ObjectTreeNode <IObjectTreeNode <object> >(); var list = new ObjectList <object> { "item1", "item2", "item3" }; childWithList.Item = list; rootNode.AddChild(childWithList); // node four with details as item var childWithDetails = new ObjectTreeNode <object>(); var detailsMap = new Details(); detailsMap.AddDetail("key1", "value1"); detailsMap.AddDetail("key2", "value2"); detailsMap.AddDetail("anyGenericObjectReference", new ObjectReference("serviceCall", "MainDB.getUsers")); detailsMap.AddDetail( "anyGenericObject", new ObjectDescription("configuration", "my_dummy_mocks_configuration.properties")); childWithDetails.Item = detailsMap; rootNode.AddChild(childWithDetails); scenario.AddDetail("exampleTree", rootNode); // act writer.SaveScenario(SerializationUseCase, scenario); writer.Flush(); // assert Assert.IsTrue(File.Exists(docuFiles.GetScenarioFile(BranchName, BuildName, SerializationUseCase, ScenarioName))); scenario.Status = "success"; writer.SaveScenario(SerializationUseCase, scenario); }
public TransactionalActivator(Transaction transaction, ObjectReference objectReference ) { _objectReference = objectReference; _transaction = transaction; }
internal static ObjectReference <Vftbl> FromAbi(IntPtr thisPtr) => ObjectReference <Vftbl> .FromAbi(thisPtr);
public DeputyBase GetOrCreateNativeReference(ObjectReference reference) { return(GetOrCreateNativeReference(new ByRefValue(reference["$jsii.byref"]))); }
void ISerializationSurrogate.GetObjectData(object obj, SerializationInfo info, StreamingContext context) { ObjectReference.GetObjectData(info, obj.GetType()); }
public static void Main(string[] args) { IedConnection con = new IedConnection(); string hostname; if (args.Length > 0) { hostname = args[0]; } else { hostname = "localhost"; } try { Console.WriteLine("Connect to " + hostname + " ..."); con.Connect(hostname, 102); Console.WriteLine("Connected."); List <string> serverDirectory = con.GetServerDirectory(false); foreach (string ldName in serverDirectory) { Console.WriteLine("LD: " + ldName); List <string> lnNames = con.GetLogicalDeviceDirectory(ldName); foreach (string lnName in lnNames) { Console.WriteLine(" LN: " + lnName); string logicalNodeReference = ldName + "/" + lnName; // discover data objects List <string> dataObjects = con.GetLogicalNodeDirectory(logicalNodeReference, ACSIClass.ACSI_CLASS_DATA_OBJECT); foreach (string dataObject in dataObjects) { Console.WriteLine(" DO: " + dataObject); List <string> dataDirectory = con.GetDataDirectoryFC(logicalNodeReference + "." + dataObject); foreach (string dataDirectoryElement in dataDirectory) { string daReference = logicalNodeReference + "." + dataObject + "." + ObjectReference.getElementName(dataDirectoryElement); // get the type specification of a variable MmsVariableSpecification specification = con.GetVariableSpecification(daReference, ObjectReference.getFC(dataDirectoryElement)); Console.WriteLine(" DA/SDO: [" + ObjectReference.getFC(dataDirectoryElement) + "] " + ObjectReference.getElementName(dataDirectoryElement) + " : " + specification.GetType() + "(" + specification.Size() + ")"); if (specification.GetType() == MmsType.MMS_STRUCTURE) { foreach (MmsVariableSpecification elementSpec in specification) { Console.WriteLine(" " + elementSpec.GetName() + " : " + elementSpec.GetType()); } } } } // discover data sets List <string> dataSets = con.GetLogicalNodeDirectory(logicalNodeReference, ACSIClass.ACSI_CLASS_DATA_SET); foreach (string dataSet in dataSets) { Console.WriteLine(" Dataset: " + dataSet); } // discover unbuffered report control blocks List <string> urcbs = con.GetLogicalNodeDirectory(logicalNodeReference, ACSIClass.ACSI_CLASS_URCB); foreach (string urcb in urcbs) { Console.WriteLine(" URCB: " + urcb); } // discover buffered report control blocks List <string> brcbs = con.GetLogicalNodeDirectory(logicalNodeReference, ACSIClass.ACSI_CLASS_BRCB); foreach (string brcb in brcbs) { Console.WriteLine(" BRCB: " + brcb); } } } con.Abort(); } catch (IedConnectionException e) { Console.WriteLine(e.Message); } }
public GetRequest(ObjectReference objectReference, string property) { ObjectReference = objectReference ?? throw new ArgumentNullException(nameof(objectReference)); Property = property ?? throw new ArgumentNullException(nameof(property)); }
public WinRTNotifyCollectionChangedEventArgsRuntimeClassFactory(ObjectReference <Vftbl> obj) { _obj = obj; }
public object NewWeakReference(ObjectReference referent, object obj) { return(obj); }
public abstract bool CanSkip(ObjectReference arg1);
public static unsafe global::System.EventHandler FromAbi(IntPtr nativeDelegate) { var abiDelegate = ObjectReference <IDelegateVftbl> .FromAbi(nativeDelegate); return((global::System.EventHandler)ComWrappersSupport.TryRegisterObjectForInterface(new global::System.EventHandler(new NativeDelegateWrapper(abiDelegate).Invoke), nativeDelegate)); }
public ValueTask Toggle() { return(ObjectReference.InvokeVoidAsync("toggle")); }
// Used for cleanup public async Task Remove() { await ObjectReference.InvokeVoidAsync("remove"); await DisposeAsync(); }
public WinRTDataErrorsChangedEventArgsRuntimeClassFactory(ObjectReference <Vftbl> obj) { _obj = obj; }
public override ObjectReference FindTargetReference(IGraphNode sourceNode, IGraphNode targetNode, ObjectReference sourceReference) { if (sourceReference.Index.IsEmpty) { return(base.FindTargetReference(sourceNode, targetNode, sourceReference)); } var matchValue = 0; if (sourceReference.TargetNode != null) { matchValue = (int)sourceReference.TargetNode[nameof(SimpleClass.Member1)].Retrieve(); } var targetReference = (targetNode as IObjectNode)?.ItemReferences; return(targetReference?.FirstOrDefault(x => (int)x.TargetNode[nameof(SimpleClass.Member1)].Retrieve() == matchValue)); }
public WithClause(ObjectReference objectReference, WithMode mode, WithType type) { _objectReference = objectReference; _mode = mode; _type = type; }
public override void AddNewReference(ObjectReference @ref) { _newReferences.AddNewReference(@ref); }
private static IEnumerable<Tuple<string, string>> DynamicReferenceToTuplePairs(ObjectReference reference, string schema) { return reference.GetAllObjectNames() .SkipWhile(s => s.Equals(schema, StringComparison.OrdinalIgnoreCase)) .SkipLast() .ToTuplePairs(); }
public override void AddExistingReference(ObjectReference @ref) { _committedReferences.AddExistingReference(@ref); }
public Nullable(ObjectReference <Vftbl> obj) { _obj = obj; }
public static void DisposeAbi(IntPtr abi) { using var objRef = ObjectReference <IUnknownVftbl> .Attach(ref abi); }
private string TryFormatAsObjectReference(ObjectReference objectReference, bool excludeAlias) { if (ReferenceEquals(objectReference, null)) return null; var table = _schema.FindTable(objectReference.GetOwner().GetAllObjectNamesDotted()); var tableName = string.IsNullOrWhiteSpace(objectReference.GetOwner().GetAlias()) ? table.QualifiedName : _schema.QuoteObjectName(objectReference.GetOwner().GetAlias()); var column = table.FindColumn(objectReference.GetName()); if (excludeAlias || objectReference.GetAlias() == null) { return string.Format("{0}.{1}", tableName, column.QuotedName); } return string.Format("{0}.{1} AS {2}", tableName, column.QuotedName, _schema.QuoteObjectName(objectReference.GetAlias())); }
public void Visit(object a_object) { ObjectReference yo = (ObjectReference)((TreeIntObject)a_object)._object; this._enclosing.RemoveReference(yo); }
public ValueTask Close() { return(ObjectReference.InvokeVoidAsync("close")); }
/// <summary> /// Provides the implementation for operations that get member values. Classes derived from the <see cref="T:System.Dynamic.DynamicObject"/> class can override this method to specify dynamic behavior for operations such as getting a value for a property. /// </summary> /// <param name="binder">Provides information about the object that called the dynamic operation. The binder.Name property provides the name of the member on which the dynamic operation is performed. For example, for the Console.WriteLine(sampleObject.SampleProperty) statement, where sampleObject is an instance of the class derived from the <see cref="T:System.Dynamic.DynamicObject"/> class, binder.Name returns "SampleProperty". The binder.IgnoreCase property specifies whether the member name is case-sensitive.</param> /// <param name="result">The result of the get operation. For example, if the method is called for a property, you can assign the property value to <paramref name="result"/>.</param> /// <returns> /// true if the operation is successful; otherwise, false. If this method returns false, the run-time binder of the language determines the behavior. (In most cases, a run-time exception is thrown.) /// </returns> public override bool TryGetMember(GetMemberBinder binder, out object result) { if (binder.Name == "All") { Trace.WriteLine("The dynamic 'All' property is deprecated; use the 'All()' method instead."); result = GetAll().ToList(); return true; } result = new ObjectReference(binder.Name, new ObjectReference(_tableName, (_schema != null ? new ObjectReference(_schema.GetName()) : null), _dataStrategy)); return true; }
public virtual void RemoveReference(ObjectReference reference) { RemoveReference(new _IReferenceSource_33(reference)); }
private string TryFormatAsObjectReference(ObjectReference objectReference) { if (ReferenceEquals(objectReference, null)) return null; if (_findTable == null) { return objectReference.GetName(); } else { string associationPath; Table table = GetOwnerTable(objectReference, out associationPath); return FormatObjectPath(associationPath, table.FindColumn(objectReference.GetName()).ActualName); } }
public OrderByClause(ObjectReference reference) : this(reference, OrderByDirection.Ascending) { }
private void AssertReference(int id, ReferenceSystemTestCaseBase.Data data, ObjectReference @ref) { Assert.AreSame(@ref, _refSys.ReferenceForId(id)); Assert.AreSame(@ref, _refSys.ReferenceForObject(data)); }
public override void RemoveReference(ObjectReference @ref) { _newReferences.RemoveReference(@ref); _committedReferences.RemoveReference(@ref); }
public WithClause(ObjectReference objectReference, WithType type) : this(objectReference, WithMode.NotSpecified, type) { }
public override bool CanSkip(ObjectReference @ref) { return(false); }
public WithClause(ObjectReference objectReference) : this(objectReference, WithType.NotSpecified) { }
public async ValueTask <SpaceReference> Space(object spaceSelector = null) { await Init(); return(new(await ObjectReference.InvokeAsync <IJSObjectReference>("space", new object[] { spaceSelector }))); }
private IEnumerable<object> ResolveSubs(IDictionary<string, object> dict, ObjectReference objectReference, string key) { if (objectReference.IsNull()) return Enumerable.Empty<object>(); if (dict.ContainsKey(objectReference.GetName())) { var master = dict[objectReference.GetName()] as IDictionary<string,object>; if (master != null) { if (master.ContainsKey(key)) { return new[] {master[key]}; } } var detail = dict[objectReference.GetName()] as IEnumerable<IDictionary<string, object>>; if (detail != null) { return detail.SelectMany(d => Resolve(d, objectReference, key)); } } return ResolveSubs(dict, objectReference.GetOwner(), key); }
// Used for cleanup public async Task Destroy() { await ObjectReference.InvokeVoidAsync("destroy"); await DisposeAsync(); }
internal ObjectReference ToObjectReference() { if (_schema == null) return new ObjectReference(_tableName, _dataStrategy); var schemaReference = new ObjectReference(_schema.GetName(), _dataStrategy); return new ObjectReference(_tableName, schemaReference, _dataStrategy); }
public async ValueTask <AppReference> App(object appSelector = null) { return(new(await ObjectReference.InvokeAsync <IJSObjectReference>("app", new object[] { appSelector }))); }
public OrderByClause(ObjectReference reference, OrderByDirection direction) { _reference = reference; _direction = direction; }
public ValueTask Open() { return(ObjectReference.InvokeVoidAsync("open")); }