Example #1
0
 protected IEnumerable<FieldDeclaration> GetMembers(IMappedEntity entity)
 {
     var members = this.Linguist.Translator.Mapper.Mapping.GetMappedMembers(entity);
     foreach(var mi in members.Where(m => m.MemberType == System.Reflection.MemberTypes.Property))
     {
         var memberType = TypeHelper.GetMemberType(mi);
         var storageType = new OStorageType(memberType);
         yield return new FieldDeclaration(mi.Name, new FieldExpression(memberType, storageType, null, mi.Name), storageType);
     }
 }
Example #2
0
 private object ReadBase64Array(object value)
 {
     int count = BitConverter.ToInt32((byte[])value, 0);
     Type type = new SHS.Sage.Linq.Language.OStorageType((ODataType)BitConverter.ToInt32((byte[])value, 4)).ToNativeType(); // will only work for intrinsic primitive types
     var array = (Array)Activator.CreateInstance(type.MakeArrayType(), count);
     var idx = 8;
     var read = 0;
     for (int a = 0; a < count; a++)
     {
         array.SetValue(ReadBase64ArrayValue((byte[])value, idx, type, out read), a);
         idx += read;
     }
     return array;
 }