public static void Main (string[] args) { var instance = new CustomType(); instance.Event += PrintNumber; instance.Event += PrintNumberTimes2; instance.Event -= PrintNumber; instance.Event -= PrintNumberTimes2; }
public static void Main (string[] args) { var instance = new CustomType(); Console.WriteLine( "instance.A = {0}, instance.BaseA = {1}", instance.A, instance.BaseA ); }
public static void Main (string[] args) { dynamic instance = new CustomType(); Console.WriteLine(instance); instance.A = 2; instance.B = 4; Console.WriteLine(instance); }
public static void Main (string[] args) { var ct = new CustomType(1); var mc = new MyClass(); mc.UpdateWithNewState(2, ct); ct.Value = 3; Console.WriteLine("ct={0}, mc={1}", ct, mc); }
public static void Main (string[] args) { var list = new CustomType[] { new CustomType() }; var collection = (ICollection<CustomType>)list; foreach (var value in (ICollection<IInterface>)collection) { Console.WriteLine(value); } }
public TriangleEntity(Guid id,CustomType.Polygon polygon) : base(id) { _Polygon = polygon; var points = new Queue<CustomType.Vector2>(_Polygon.Points); var firstPoint = points.Dequeue(); float top = firstPoint.Y; float down = firstPoint.Y ; float left = firstPoint.X; float right = firstPoint.X; while (points.Count > 0) { var point = points.Dequeue(); if (point.X > right) { right = point.X; } if (point.X < left) { left = point.X; } if (point.Y < top) { top = point.Y; } if (point.Y > down) { down = point.Y; } } _QuadTreeObjectAbility = new PhysicalAbility(new Regulus.CustomType.Rect(left , top , right - left , down - top ) , this); _Polygon.BuildEdges(); }
public static void Main (string[] args) { var instance = new CustomType(); instance.BaseMethod(); instance.Method(); instance.BaseMethod2(3); instance.Method2(4); }
public static void Main (string[] args) { var a = A; var b = ReturnArgument(B); var c = B; var d = B; var e = B; var f = A; PrintArgument(a); PrintArgument(b); PrintArgument(c); StoreArgument(d); PrintArgument(Field); c.Value = 3; PrintArgument(ReturnArgument(a)); PrintArgument(b); PrintArgument(c); Field = e; PrintArgument(Field); MutateArgument(ref f); PrintArgument(f); }
public static void Main (string[] args) { var instance = new CustomType(); Console.WriteLine("{0}, {1}", instance[0], instance[1]); instance[2] = 3; }
public static void Main (string[] args) { var instance = new CustomType(); Console.WriteLine(instance.Value); instance.Value += 2; Console.WriteLine(instance.Value); Console.WriteLine(instance.Value += 2); Console.WriteLine(instance.Value); }
public static void Main (string[] args) { var instance = new CustomType(); instance.A(); ((IInterface1)instance).A(); ((IInterface2)instance).A(); ((IInterface3)instance).A(); }
public static void Main (string[] args) { CustomType a = new CustomType(1), b = new CustomType(2), c = a; Console.WriteLine("a={0}, b={1}, c={2}", a, b, c); a *= b; Console.WriteLine("a={0}, b={1}, c={2}", a, b, c); c.Value = 16; Console.WriteLine("a={0}, b={1}, c={2}", a, b, c); }
public static void Main (string[] args) { var a = new CustomType(1); var b = new CustomType(2); var c = a; Console.WriteLine("a==a: {0}, a==b: {1}, a==c: {2}", a.Equals(a), a.Equals(b), a.Equals(c)); c.Value = 3; Console.WriteLine("a==a: {0}, a==b: {1}, a==c: {2}", a.Equals(a), a.Equals(b), a.Equals(c)); }
public static void Main (string[] args) { CustomType a = new CustomType(1), b = new CustomType(2); Console.WriteLine("a={0}, b={1}", a, b); b = a; Console.WriteLine("a={0}, b={1}", a, b); b = new CustomType(3); Console.WriteLine("a={0}, b={1}", a, b); }
public When_converting_to_object_based_on_typeinfo() { var dynamicObject = new DynamicObject(typeof(CustomType)) { { "StringValue", StringValue }, }; obj = dynamicObject.CreateObject() as CustomType; }
public static void Main (string[] args) { Console.WriteLine("A.Field = {0}, A.Property = {1}", A.Field, A.Property); var a = A; a.Field = 1; a.Property = 2; Console.WriteLine("A.Field = {0}, A.Property = {1}", A.Field, A.Property); A = a; Console.WriteLine("A.Field = {0}, A.Property = {1}", A.Field, A.Property); }
public static void Main (string[] args) { var a = new CustomType(1); CustomType b = ReturnArgument(ReturnIncrementedArgument(ReturnArgument(a))); Console.WriteLine("a={0}, b={1}", a, b); a.Value = 3; Console.WriteLine("a={0}, b={1}", a, b); b = ReturnArgument(ReturnArgument(a)); Console.WriteLine("a={0}, b={1}", a, b); }
public static void Main (string[] args) { Console.WriteLine("Field.Field = {0}, Field.Property = {1}", Field.Field, Field.Property); var a = Field; a.Field = 1; a.Property = 2; Console.WriteLine("Field.Field = {0}, Field.Property = {1}", Field.Field, Field.Property); Field = a; Console.WriteLine("Field.Field = {0}, Field.Property = {1}", Field.Field, Field.Property); }
public void ArrayCanBeOfAnyType() { CustomType[] arrayOfCustomTypes = new CustomType[] { new CustomType() }; Assert.AreSame(____, arrayOfCustomTypes.GetType(), "Array elements can be of any type, including an array type."); int[] array = { 1, 2, 3 }; ChangeSecondElementOfArrayToOne(array); Assert.AreEqual(____, array[1], "Array types are reference types derived from the abstract base type Array"); }
public static void Main (string[] args) { var cts = new CustomType[3]; cts[0] = new CustomType(1); cts[1] = new CustomType(2.5f); cts[2] = cts[0]; cts[0] *= 3; cts[2].Value = 16; Console.WriteLine("1={0}, 2={1}, 3={2}", cts[0], cts[1], cts[2]); }
public static void Main (string[] args) { var a = new CustomType(1); var b = new CustomType(2); var c = new CustomType(3); var d = CustomType.AddThree(a, b, c); Console.WriteLine("a={0}, b={1}, c={2}, d={3}", a, b, c, d); d = ReturnArgument(CustomType.AddThree(a, b, c)); Console.WriteLine("a={0}, b={1}, c={2}, d={3}", a, b, c, d); }
public static void Main (string[] args) { var instanceA = new CustomType(); var instanceB = new CustomType2(); Console.WriteLine( "{0} {1} {2} {3}", instanceA, instanceA.GetType(), instanceB, instanceB.GetType() ); }
public static void Main (string[] args) { var a = new CustomType(1); var b = new CustomType(2); var c = a + b; Console.WriteLine("a={0}, b={1}, c={2}", a, b, c); c = ReturnArgument(a + b); Console.WriteLine("a={0}, b={1}, c={2}", a, b, c); Console.WriteLine("{0}", a + c); }
public static void Main (string[] args) { var a = new CustomType(1); CustomType b = a; a.Value = 2; Console.WriteLine("a={0}, b={1}", a, b); b = a; Console.WriteLine("a={0}, b={1}", a, b); a.Value = 3; Console.WriteLine("a={0}, b={1}", a, b); }
public static void Main (string[] args) { var instance1 = new CustomType(1); var instance2 = new CustomType(2); Action a = instance1.Method; Action b = instance2.Method; a(); b(); }
public When_converting_to_object_with_additional_properties() { var dynamicObject = new DynamicObject { { "Int32Value", Int32Value }, { "StringValue", StringValue }, }; obj = dynamicObject.CreateObject<CustomType>(); }
public static void Main (string[] args) { var instance = new CustomType(); int i = 0; Console.WriteLine(".B = {0}, i = {1}", instance.B, i); instance.Method(ref i); Console.WriteLine(".B = {0}, i = {1}", instance.B, i); instance.Method(ref i); Console.WriteLine(".B = {0}, i = {1}", instance.B, i); }
public static void Main (string[] args) { object instance = new CustomType(); var ii1 = instance as IInterface1; var ii2 = instance as IInterface2; ii1.Interface1Method(1); ii2.Interface1Method(2); ii2.Interface2Method(3); }
public static void Main (string[] args) { Console.WriteLine("A = {0}, _A = {1}", A, _A); A = 4; Console.WriteLine("A = {0}, _A = {1}", A, _A); var instance = new CustomType(); Console.WriteLine(instance); instance.A = 4; Console.WriteLine(instance); }
public When_converting_to_object_with_private_property_setter() { var dynamicObject = new DynamicObject { { "Int32Value", Int32Value }, { "DoubleValue", DoubleValue }, { "StringValue", StringValue }, }; obj = dynamicObject.CreateObject<CustomType>(); }
private bool RegisterCustomTypeInternal <T>(Func <T> constructor) where T : INetSerializable { var t = typeof(T); if (_registeredCustomTypes.ContainsKey(t)) { return(false); } var rwDelegates = new CustomType( (writer, obj) => { ((T)obj).Serialize(writer); }, reader => { var instance = constructor(); instance.Deserialize(reader); return(instance); }); _registeredCustomTypes.Add(t, rwDelegates); return(true); }
public void PreventRecursion() { using (var store = NewDocumentStore()) { var item = new CustomType { Id = "Item/1", Value = 1 }; using (var s = store.OpenSession()) { s.Store(item); s.SaveChanges(); } store .DatabaseCommands .Patch("Item/1", new ScriptedPatchRequest { Script = "this.Test = this" }); var doc = store.DatabaseCommands.Get("Item/1"); Assert.NotNull(doc); Assert.Equal("1", doc.DataAsJson["Value"]); var patchedField = (RavenJObject)doc.DataAsJson["Test"]; Assert.Equal("1", patchedField["Value"]); patchedField = patchedField["Test"] as RavenJObject; Assert.Null(patchedField); } }
public virtual IPositionalBindAction SetCustomType(CustomType datatype) { CustomType = datatype; return(this); }
public static void CustomTypeTopic( [DaprTopicTrigger] CustomType input, ILogger log) => log.LogInformation(JsonConvert.SerializeObject(input));
/// <summary> /// LUA结构支持 /// </summary> /// <returns></returns> public override void GetLuaStruct(StringBuilder code) { base.GetLuaStruct(code); int idx; if (!string.IsNullOrWhiteSpace(PropertyName)) { code.AppendLine($@"['PropertyName'] = '{PropertyName.ToLuaString()}',"); } else { code.AppendLine($@"['PropertyName'] = nil,"); } code.AppendLine($@"['IsCaption'] ={(IsCaption.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(Alias)) { code.AppendLine($@"['Alias'] = '{Alias.ToLuaString()}',"); } else { code.AppendLine($@"['Alias'] = nil,"); } if (!string.IsNullOrWhiteSpace(Group)) { code.AppendLine($@"['Group'] = '{Group.ToLuaString()}',"); } else { code.AppendLine($@"['Group'] = nil,"); } code.AppendLine($@"['CreateIndex'] ={(CreateIndex.ToString().ToLower())},"); code.AppendLine($@"['IsPrimaryKey'] ={(IsPrimaryKey.ToString().ToLower())},"); code.AppendLine($@"['IsExtendKey'] ={(IsExtendKey.ToString().ToLower())},"); code.AppendLine($@"['IsIdentity'] ={(IsIdentity.ToString().ToLower())},"); code.AppendLine($@"['IsGlobalKey'] ={(IsGlobalKey.ToString().ToLower())},"); code.AppendLine($@"['UniqueIndex'] ={UniqueIndex},"); code.AppendLine($@"['IsRequired'] ={(IsRequired.ToString().ToLower())},"); code.AppendLine($@"['IsUserReadOnly'] ={(IsUserReadOnly.ToString().ToLower())},"); code.AppendLine($@"['IsMemo'] ={(IsMemo.ToString().ToLower())},"); code.AppendLine($@"['DenyClient'] ={(DenyClient.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(Prefix)) { code.AppendLine($@"['Prefix'] = '{Prefix.ToLuaString()}',"); } else { code.AppendLine($@"['Prefix'] = nil,"); } if (!string.IsNullOrWhiteSpace(Suffix)) { code.AppendLine($@"['Suffix'] = '{Suffix.ToLuaString()}',"); } else { code.AppendLine($@"['Suffix'] = nil,"); } if (!string.IsNullOrWhiteSpace(InputType)) { code.AppendLine($@"['InputType'] = '{InputType.ToLuaString()}',"); } else { code.AppendLine($@"['InputType'] = nil,"); } if (!string.IsNullOrWhiteSpace(ComboBoxUrl)) { code.AppendLine($@"['ComboBoxUrl'] = '{ComboBoxUrl.ToLuaString()}',"); } else { code.AppendLine($@"['ComboBoxUrl'] = nil,"); } code.AppendLine($@"['IsMoney'] ={(IsMoney.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(GridAlign)) { code.AppendLine($@"['GridAlign'] = '{GridAlign.ToLuaString()}',"); } else { code.AppendLine($@"['GridAlign'] = nil,"); } if (!string.IsNullOrWhiteSpace(DataFormater)) { code.AppendLine($@"['DataFormater'] = '{DataFormater.ToLuaString()}',"); } else { code.AppendLine($@"['DataFormater'] = nil,"); } code.AppendLine($@"['DenyClient'] ={(DenyClient.ToString().ToLower())},"); code.AppendLine($@"['GridDetails'] ={(GridDetails.ToString().ToLower())},"); code.AppendLine($@"['NoneGrid'] ={(NoneGrid.ToString().ToLower())},"); code.AppendLine($@"['NoneDetails'] ={(NoneDetails.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(GridDetailsCode)) { code.AppendLine($@"['GridDetailsCode'] = '{GridDetailsCode.ToLuaString()}',"); } else { code.AppendLine($@"['GridDetailsCode'] = nil,"); } if (!string.IsNullOrWhiteSpace(CppType)) { code.AppendLine($@"['CppType'] = '{CppType.ToLuaString()}',"); } else { code.AppendLine($@"['CppType'] = nil,"); } if (CppTypeObject != null) { code.AppendLine($@"['CppTypeObject'] ='{CppTypeObject}',"); } if (!string.IsNullOrWhiteSpace(CppName)) { code.AppendLine($@"['CppName'] = '{CppName.ToLuaString()}',"); } else { code.AppendLine($@"['CppName'] = nil,"); } if (!string.IsNullOrWhiteSpace(CppLastType)) { code.AppendLine($@"['CppLastType'] = '{CppLastType.ToLuaString()}',"); } else { code.AppendLine($@"['CppLastType'] = nil,"); } code.AppendLine($@"['IsIntDecimal'] ={(IsIntDecimal.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(CsType)) { code.AppendLine($@"['CsType'] = '{CsType.ToLuaString()}',"); } else { code.AppendLine($@"['CsType'] = nil,"); } if (!string.IsNullOrWhiteSpace(CustomType)) { code.AppendLine($@"['CustomType'] = '{CustomType.ToLuaString()}',"); } else { code.AppendLine($@"['CustomType'] = nil,"); } if (!string.IsNullOrWhiteSpace(LastCsType)) { code.AppendLine($@"['LastCsType'] = '{LastCsType.ToLuaString()}',"); } else { code.AppendLine($@"['LastCsType'] = nil,"); } if (EnumConfig != null) { code.AppendLine($@"['EnumConfig'] = {EnumConfig.GetLuaStruct()},"); } code.AppendLine($@"['IsCompute'] ={(IsCompute.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(ComputeGetCode)) { code.AppendLine($@"['ComputeGetCode'] = '{ComputeGetCode.ToLuaString()}',"); } else { code.AppendLine($@"['ComputeGetCode'] = nil,"); } if (!string.IsNullOrWhiteSpace(ComputeSetCode)) { code.AppendLine($@"['ComputeSetCode'] = '{ComputeSetCode.ToLuaString()}',"); } else { code.AppendLine($@"['ComputeSetCode'] = nil,"); } code.AppendLine($@"['IsMiddleField'] ={(IsMiddleField.ToString().ToLower())},"); code.AppendLine($@"['InnerField'] ={(InnerField.ToString().ToLower())},"); code.AppendLine($@"['IsSystemField'] ={(IsSystemField.ToString().ToLower())},"); code.AppendLine($@"['IsInterfaceField'] ={(IsInterfaceField.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(Initialization)) { code.AppendLine($@"['Initialization'] = '{Initialization.ToLuaString()}',"); } else { code.AppendLine($@"['Initialization'] = nil,"); } if (!string.IsNullOrWhiteSpace(EmptyValue)) { code.AppendLine($@"['EmptyValue'] = '{EmptyValue.ToLuaString()}',"); } else { code.AppendLine($@"['EmptyValue'] = nil,"); } code.AppendLine($@"['DenyScope'] ='{DenyScope}',"); code.AppendLine($@"['Nullable'] ={(Nullable.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(Max)) { code.AppendLine($@"['Max'] = '{Max.ToLuaString()}',"); } else { code.AppendLine($@"['Max'] = nil,"); } if (!string.IsNullOrWhiteSpace(Min)) { code.AppendLine($@"['Min'] = '{Min.ToLuaString()}',"); } else { code.AppendLine($@"['Min'] = nil,"); } code.AppendLine($@"['UniqueString'] ={(UniqueString.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(ColumnName)) { code.AppendLine($@"['ColumnName'] = '{ColumnName.ToLuaString()}',"); } else { code.AppendLine($@"['ColumnName'] = nil,"); } code.AppendLine($@"['DbNullable'] ={(DbNullable.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(DbType)) { code.AppendLine($@"['DbType'] = '{DbType.ToLuaString()}',"); } else { code.AppendLine($@"['DbType'] = nil,"); } code.AppendLine($@"['Precision'] ={Datalen},"); if (!string.IsNullOrWhiteSpace(ArrayLen)) { code.AppendLine($@"['ArrayLen'] = '{ArrayLen.ToLuaString()}',"); } else { code.AppendLine($@"['ArrayLen'] = nil,"); } code.AppendLine($@"['Scale'] ={Scale},"); code.AppendLine($@"['DbIndex'] ={DbIndex},"); code.AppendLine($@"['Unicode'] ={(Unicode.ToString().ToLower())},"); code.AppendLine($@"['FixedLength'] ={(FixedLength.ToString().ToLower())},"); code.AppendLine($@"['IsBlob'] ={(IsBlob.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(StorageProperty)) { code.AppendLine($@"['StorageProperty'] = '{StorageProperty.ToLuaString()}',"); } else { code.AppendLine($@"['StorageProperty'] = nil,"); } code.AppendLine($@"['DbInnerField'] ={(DbInnerField.ToString().ToLower())},"); code.AppendLine($@"['NoStorage'] ={(NoStorage.ToString().ToLower())},"); code.AppendLine($@"['KeepStorageScreen'] ='{KeepStorageScreen}',"); code.AppendLine($@"['CustomWrite'] ={(CustomWrite.ToString().ToLower())},"); code.AppendLine($@"['IsLinkField'] ={(IsLinkField.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(LinkTable)) { code.AppendLine($@"['LinkTable'] = '{LinkTable.ToLuaString()}',"); } else { code.AppendLine($@"['LinkTable'] = nil,"); } code.AppendLine($@"['IsLinkKey'] ={(IsLinkKey.ToString().ToLower())},"); code.AppendLine($@"['IsLinkCaption'] ={(IsLinkCaption.ToString().ToLower())},"); code.AppendLine($@"['IsUserId'] ={(IsUserId.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(LinkField)) { code.AppendLine($@"['LinkField'] = '{LinkField.ToLuaString()}',"); } else { code.AppendLine($@"['LinkField'] = nil,"); } code.AppendLine($@"['IsCustomCompute'] ={(IsCustomCompute.ToString().ToLower())},"); code.AppendLine($@"['CanGet'] ={(CanGet.ToString().ToLower())},"); code.AppendLine($@"['CanSet'] ={(CanSet.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(AccessType)) { code.AppendLine($@"['AccessType'] = '{AccessType.ToLuaString()}',"); } else { code.AppendLine($@"['AccessType'] = nil,"); } code.AppendLine($@"['ReadOnly'] ={(ReadOnly.ToString().ToLower())},"); code.AppendLine($@"['CanInput'] ={(CanUserInput.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(ExtendRole)) { code.AppendLine($@"['ExtendRole'] = '{ExtendRole.ToLuaString()}',"); } else { code.AppendLine($@"['ExtendRole'] = nil,"); } if (!string.IsNullOrWhiteSpace(ValueSeparate)) { code.AppendLine($@"['ValueSeparate'] = '{ValueSeparate.ToLuaString()}',"); } else { code.AppendLine($@"['ValueSeparate'] = nil,"); } if (!string.IsNullOrWhiteSpace(ArraySeparate)) { code.AppendLine($@"['ArraySeparate'] = '{ArraySeparate.ToLuaString()}',"); } else { code.AppendLine($@"['ArraySeparate'] = nil,"); } code.AppendLine($@"['ExtendArray'] ={(ExtendArray.ToString().ToLower())},"); code.AppendLine($@"['IsKeyValueArray'] ={(IsKeyValueArray.ToString().ToLower())},"); code.AppendLine($@"['IsRelation'] ={(IsRelation.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(ExtendPropertyName)) { code.AppendLine($@"['ExtendPropertyName'] = '{ExtendPropertyName.ToLuaString()}',"); } else { code.AppendLine($@"['ExtendPropertyName'] = nil,"); } if (!string.IsNullOrWhiteSpace(ExtendClassName)) { code.AppendLine($@"['ExtendClassName'] = '{ExtendClassName.ToLuaString()}',"); } else { code.AppendLine($@"['ExtendClassName'] = nil,"); } code.AppendLine($@"['ExtendClassIsPredestinate'] ={(ExtendClassIsPredestinate.ToString().ToLower())},"); code.AppendLine($@"['IsRelationField'] ={(IsRelationField.ToString().ToLower())},"); code.AppendLine($@"['IsRelationValue'] ={(IsRelationValue.ToString().ToLower())},"); code.AppendLine($@"['IsRelationArray'] ={(IsRelationArray.ToString().ToLower())},"); code.AppendLine($@"['IsExtendArray'] ={(IsExtendArray.ToString().ToLower())},"); code.AppendLine($@"['IsExtendValue'] ={(IsExtendValue.ToString().ToLower())},"); }
public bool Equals(CustomType other) => other.value == value;
public TestableCustomConstructorInfo(CustomType declaringType, MethodAttributes attributes) : base(declaringType, attributes) { }
public static CustomType Convert(string oratype) { CustomType custom = null; switch (oratype) { case "anydata": custom = new CustomType("anydata", typeof(string), OracleDbType.NVarchar2); break; case "anytype": custom = new CustomType("anytype", typeof(string), OracleDbType.NVarchar2); break; case "bfile": custom = new CustomType("bfile", typeof(string), OracleDbType.BFile); break; case "binary_double": custom = new CustomType("binary double", typeof(double), OracleDbType.Double); break; case "binary_float": custom = new CustomType("binary float", typeof(float), OracleDbType.Decimal); break; case "binary_integer": custom = new CustomType("binary integer", typeof(int), OracleDbType.Int32); break; case "blob": custom = new CustomType("blob", typeof(string), OracleDbType.Blob); break; case "boolean": custom = new CustomType("boolean", typeof(bool), OracleDbType.Int32); break; case "char": // set the type to 'string' to allow for any number of chars custom = new CustomType("char", typeof(string), OracleDbType.Char); break; case "clob": custom = new CustomType("clob", typeof(string), OracleDbType.Clob); break; case "date": custom = new CustomType("date", typeof(DateTime), OracleDbType.Date); break; case "double precision": custom = new CustomType("double", typeof(double), OracleDbType.Double); break; case "float": custom = new CustomType("float", typeof(float), OracleDbType.Decimal); break; case "integer": custom = new CustomType("integer", typeof(int), OracleDbType.Int32); break; case "interval day to second": custom = new CustomType("interval ds", typeof(int), OracleDbType.IntervalDS); break; case "interval year to month": custom = new CustomType("interval ym", typeof(int), OracleDbType.IntervalYM); break; case "long": custom = new CustomType("long", typeof(long), OracleDbType.Long); break; case "long raw": custom = new CustomType("long raw", typeof(string), OracleDbType.LongRaw); break; case "mlslabel": custom = new CustomType("mlslabel", typeof(string), OracleDbType.Varchar2); break; case "number": custom = new CustomType("number", typeof(int), OracleDbType.Int32); break; case "object": custom = new CustomType("object", typeof(object), OracleDbType.NClob); break; case "pl/sql record": custom = new CustomType("record", typeof(object), OracleDbType.RefCursor); break; case "pl/sql table": custom = new CustomType("table", typeof(object), OracleDbType.RefCursor); break; case "pls_integer": custom = new CustomType("pls_integer", typeof(int), OracleDbType.Int32); break; case "raw": custom = new CustomType("raw", typeof(string), OracleDbType.Raw); break; case "real": custom = new CustomType("real", typeof(decimal), OracleDbType.Decimal); break; case "ref": custom = new CustomType("ref", typeof(object), OracleDbType.RefCursor); break; case "ref cursor": custom = new CustomType("ref cursor", typeof(object), OracleDbType.RefCursor); break; case "rowid": custom = new CustomType("rowid", typeof(int), OracleDbType.Int32); break; case "smallint": custom = new CustomType("smallint", typeof(short), OracleDbType.Int16); break; case "standard": custom = new CustomType("standard", typeof(int), OracleDbType.Single); break; case "string": custom = new CustomType("string", typeof(string), OracleDbType.NVarchar2); break; case "table": custom = new CustomType("table", typeof(object), OracleDbType.RefCursor); break; case "time": custom = new CustomType("time", typeof(DateTime), OracleDbType.Date); break; case "time with time zone": custom = new CustomType("time_tz", typeof(DateTime), OracleDbType.TimeStampTZ); break; case "timestamp": custom = new CustomType("timestamp", typeof(DateTime), OracleDbType.TimeStamp); break; case "timestamp with local time zone": custom = new CustomType("timestamp_ltz", typeof(DateTime), OracleDbType.TimeStampLTZ); break; case "timestamp with time zone": custom = new CustomType("timestamp_tz", typeof(DateTime), OracleDbType.TimeStampTZ); break; case "urowid": custom = new CustomType("urowid", typeof(int), OracleDbType.Int32); break; case "varchar2": custom = new CustomType("varchar2", typeof(string), OracleDbType.Varchar2); break; case "varray": custom = new CustomType("varray", typeof(string), OracleDbType.NVarchar2); break; case "xmltype": custom = new CustomType("xmltype", typeof(string), OracleDbType.XmlType); break; } return(custom); }
public string GetName(CustomType ct) { return(this.tableNameProvider.GetName(ct)); }
public static void PrintArgument(CustomType value) { Console.WriteLine("{0}", value); }
public static void StoreArgument(CustomType value) { Field = value; }
public static void MutateArgument(ref CustomType value) { value.Value += 1; }
public static void Increment(ref CustomType ct) { ct.Value += 1; }
public void Bad(CustomType x) { }
public static void IncreaseArgument(ref CustomType arg) { arg.Value += 1; }
public override string ToString() { var bindtype = UseCache ? $"usando cache {CacheName}" : Value != null ? $"o valor {Value}" : ""; return($"{base.ToString()} no type {Type}.{PropertyToBind} {bindtype}, mascara {Mask}, customMask: {CustomMask.GetDescription()}, customType: {CustomType.GetDescription()}"); }
Type ICustomTypeProvider.GetCustomType() { return(customType ?? (customType = GetCustomType(GetType(), commandProperties.Values))); }
private void ExecuteSetBasedTest(IDocumentStore store) { var item1 = new CustomType { Id = "someId/", Owner = "bob", Value = 12143, Comments = new List <string>(new[] { "one", "two", "seven" }) }; var item2 = new CustomType { Id = "someId/", Owner = "NOT bob", Value = 9999, Comments = new List <string>(new[] { "one", "two", "seven" }) }; using (var s = store.OpenSession()) { s.Store(item1); s.Store(item2); s.SaveChanges(); } store.DatabaseCommands.PutIndex("TestIndex", new IndexDefinition { Map = @"from doc in docs select new { doc.Owner }" }); WaitForUserToContinueTheTest(store); store.OpenSession().Advanced.DocumentQuery <CustomType>("TestIndex") .WaitForNonStaleResults().ToList(); store.DatabaseCommands.UpdateByIndex("TestIndex", new IndexQuery { Query = "Owner:Bob" }, new ScriptedPatchRequest { Script = sampleScript }) .WaitForCompletion(); var item1ResultJson = store.DatabaseCommands.Get(item1.Id).DataAsJson; var item1Result = JsonConvert.DeserializeObject <CustomType>(item1ResultJson.ToString()); Assert.Equal(2, item1Result.Comments.Count); Assert.Equal("one test", item1Result.Comments[0]); Assert.Equal("two", item1Result.Comments[1]); Assert.Equal(12144, item1Result.Value); Assert.Equal("err!!", item1ResultJson["newValue"]); var item2ResultJson = store.DatabaseCommands.Get(item2.Id).DataAsJson; var item2Result = JsonConvert.DeserializeObject <CustomType>(item2ResultJson.ToString()); Assert.Equal(9999, item2Result.Value); Assert.Equal(3, item2Result.Comments.Count); Assert.Equal("one", item2Result.Comments[0]); Assert.Equal("two", item2Result.Comments[1]); Assert.Equal("seven", item2Result.Comments[2]); }
public static CustomType AddThree(CustomType a, CustomType b, CustomType c) { return(a + (b + c)); }
public static CustomType IncrementArgument(CustomType arg) { arg.Value += 1; return(arg); }
#pragma warning restore 414 public CustomException(string msg, CustomType custom) : base(msg) { this.custom = custom; }
public void Create_WhenCreatingFieldWithInitializer_ShouldGenerateCorrectCode() { Assert.AreEqual("ILogger_logger=LoggerService.Logger();", FieldGenerator.Create(new Field("_logger", CustomType.Create("ILogger"), initializeWith: ReferenceGenerator.Create(new VariableReference("LoggerService", new MethodReference("Logger"))))).ToString()); }
public static CustomType ReturnArgument(CustomType arg) { return(arg); }
public string GetValue(CustomType customType, int parentId, string key) { var field = _db.CustomFields.Where(f => f.CustomType == customType && f.ParentId == parentId && f.CustomKey == key).FirstOrDefault(); return(field == null ? string.Empty : field.CustomValue); }
public static void Method(CustomType ct) { Console.WriteLine("Method(<CustomType>)"); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void copyTable(org.hibernate.mapping.PersistentClass paramPersistentClass) throws Exception private void copyTable(PersistentClass paramPersistentClass) { string str = paramPersistentClass.Table.Name; StringBuilder stringBuffer1 = new StringBuilder(); StringBuilder stringBuffer2 = new StringBuilder(); StringBuilder stringBuffer3 = new StringBuilder(); System.Collections.IList list1 = this.source.listPropertyColumns(paramPersistentClass); System.Collections.IList list2 = this.source.listNonPropertyColumns(paramPersistentClass); System.Collections.IList list3 = this.source.listProperties(paramPersistentClass); System.Collections.IList list4 = this.source.listAllColumns(paramPersistentClass); stringBuffer1.Append("SELECT "); stringBuffer2.Append("INSERT INTO "); stringBuffer2.Append(str); stringBuffer2.Append("("); bool @bool = true; sbyte b = 1; HashSet <object> hashSet = new HashSet <object>(); foreach (Column column in list4) { string str1 = column.Name; if (hashSet.Contains(str1)) { continue; } hashSet.Add(str1); if (!@bool) { stringBuffer1.Append(","); stringBuffer2.Append(","); stringBuffer3.Append(","); } else { @bool = false; } stringBuffer1.Append(str1); stringBuffer2.Append(str1); stringBuffer3.Append("?"); b++; } stringBuffer1.Append(" FROM "); stringBuffer1.Append(str); stringBuffer2.Append(") VALUES ("); stringBuffer2.Append(stringBuffer3); stringBuffer2.Append(")"); preparedStatement = null; resultSet = null; try { str1 = "select count(" + ((Column)list1[0]).Name + ") from " + str; resultSet = executeResultSetQuery(this.sourceConnection, str1); int i; for (i = 0; resultSet.next(); i = resultSet.getInt(1)) { ; } resultSet.close(); this.progress.Indeterminate = false; this.progress.setProgress("Storing [" + str + "] data...", 0); this.progress.TotalTimes = i; preparedStatement = prepareStatement(this.destConnection, constructInsertPrefixForTable(this.dest, str) + stringBuffer2.ToString() + constructInsertSuffixForTable(this.dest, str)); resultSet = executeResultSetQuery(this.sourceConnection, stringBuffer1.ToString()); sbyte b1 = 0; while (resultSet.next()) { b1++; int j; for (j = 1; j <= list1.Count; j++) { Property property = (Property)list3[j - true]; if (property.Type is org.hibernate.type.BigDecimalType) { preparedStatement.setBigDecimal(j, resultSet.getBigDecimal(j)); } else if (property.Type is org.hibernate.type.BigIntegerType) { preparedStatement.setBigDecimal(j, resultSet.getBigDecimal(j)); } else if (property.Type is org.hibernate.type.LongType) { preparedStatement.setBigDecimal(j, resultSet.getBigDecimal(j)); } else if (property.Type is org.hibernate.type.BooleanType) { preparedStatement.setBoolean(j, resultSet.getBoolean(j)); } else if (property.Type is org.hibernate.type.DoubleType) { preparedStatement.setBigDecimal(j, resultSet.getBigDecimal(j)); } else if (property.Type is org.hibernate.type.IntegerType) { preparedStatement.setBigDecimal(j, resultSet.getBigDecimal(j)); } else if (property.Type is org.hibernate.type.TimestampType) { preparedStatement.setTimestamp(j, resultSet.getTimestamp(j)); } else if (property.Type is org.hibernate.type.DateType) { preparedStatement.setDate(j, resultSet.getDate(j)); } else if (property.Type is org.hibernate.type.BlobType) { preparedStatement.setBlob(j, resultSet.getBlob(j)); } else if (property.Type is org.hibernate.type.BinaryType) { preparedStatement.setBytes(j, resultSet.getBytes(j)); } else if (property.Type is nomitech.common.db.types.CostOSTextType) { preparedStatement.setClob(j, resultSet.getClob(j)); } else if (property.Type is nomitech.common.db.types.CostOSStringType) { preparedStatement.setString(j, resultSet.getString(j)); } else if (property.Type is CustomType) { CustomType customType = (CustomType)property.Type; //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: if (customType.Name.Equals(typeof(nomitech.common.db.types.NotNullTextType).FullName)) { preparedStatement.setClob(j, resultSet.getClob(j)); } else { string str2 = resultSet.getString(j); if (!string.ReferenceEquals(str2, null) && str2.Length >= 255) { str2 = str2.Substring(0, 254); } preparedStatement.setString(j, str2); } } else { string str2 = resultSet.getString(j); if (!string.ReferenceEquals(str2, null) && str2.Length >= 255) { str2 = str2.Substring(0, 254); } preparedStatement.setString(j, str2); } } for (j = 1; j <= list2.Count; j++) { int k = list1.Count + j; Column column = (Column)list2[j - 1]; preparedStatement.setBigDecimal(k, resultSet.getBigDecimal(k)); } preparedStatement.execute(); this.progress.incrementProgress(1); } } catch (SQLException sQLException) { Console.WriteLine(sQLException.ToString()); Console.Write(sQLException.StackTrace); throw new Exception(sQLException); } finally { try { if (preparedStatement != null) { preparedStatement.close(); } } catch (SQLException sQLException) { throw new Exception(sQLException); } try { if (resultSet != null) { resultSet.close(); } } catch (SQLException sQLException) { throw new Exception(sQLException); } } this.progress.Indeterminate = true; }
public static void Main(string[] args) { dynamic instance = new CustomType(); Console.WriteLine("A = {0}, B = {1}", instance.A, instance.B); }
public async Task CanPerformAdvancedWithSetBasedUpdates() { using (var store = GetDocumentStore()) { var item1 = new CustomType { Id = "someId/", Owner = "bob", Value = 12143, Comments = new List <string>(new[] { "one", "two", "seven" }) }; var item2 = new CustomType { Id = "someId/", Owner = "NOT bob", Value = 9999, Comments = new List <string>(new[] { "one", "two", "seven" }) }; using (var session = store.OpenAsyncSession()) { await session.StoreAsync(item1); await session.StoreAsync(item2); await session.SaveChangesAsync(); } store.Maintenance.Send(new PutIndexesOperation(new[] { new IndexDefinition { Maps = { @"from doc in docs.CustomTypes select new { doc.Owner }" }, Name = "TestIndex" } })); WaitForIndexing(store); var operation = store.Operations.Send(new PatchByQueryOperation( $"FROM INDEX \'TestIndex\' WHERE Owner = \'Bob\' UPDATE {{ {SampleScript}}}")); operation.WaitForCompletion(TimeSpan.FromSeconds(15)); using (var commands = store.Commands()) { dynamic item1ResultJson = await commands.GetAsync(item1.Id); var item1Result = commands.Deserialize <CustomType>(item1ResultJson.BlittableJson); Assert.Equal(2, item1Result.Comments.Count); Assert.Equal("one test", item1Result.Comments[0]); Assert.Equal("two", item1Result.Comments[1]); Assert.Equal(12144, item1Result.Value); Assert.Equal("err!!", item1ResultJson.newValue.ToString()); dynamic item2ResultJson = await commands.GetAsync(item2.Id); var item2Result = commands.Deserialize <CustomType>(item2ResultJson.BlittableJson); Assert.Equal(9999, item2Result.Value); Assert.Equal(3, item2Result.Comments.Count); Assert.Equal("one", item2Result.Comments[0]); Assert.Equal("two", item2Result.Comments[1]); Assert.Equal("seven", item2Result.Comments[2]); } } }
public static void ReplaceArgument(ref CustomType arg) { arg = new CustomType(4); }
public void SetUp() { _elementType = CustomTypeObjectMother.Create(); _type = new VectorType(_elementType); }