Exemple #1
0
        private static void InitRole(ProtoBuf.Meta.RuntimeTypeModel model)
        {
            DataBaseObjectRole obj;

            model.Add(typeof(DataBaseObjectRole), false).Add(
                nameof(obj.ConcurrencyStamp),
                nameof(obj.Id),
                nameof(obj.Name),
                nameof(obj.NormalizedName)
                );
        }
Exemple #2
0
        private static void InitJobItemGetOutput(ProtoBuf.Meta.RuntimeTypeModel model)
        {
            ModDummyMainBaseJobItemGetOutput obj;

            model.Add(typeof(ModDummyMainBaseJobItemGetOutput), false).Add(
                nameof(obj.ObjectDummyMain),
                nameof(obj.ObjectsDummyManyToMany),
                nameof(obj.ObjectsDummyMainDummyManyToMany),
                nameof(obj.ObjectDummyOneToMany)
                );
        }
Exemple #3
0
        private static void InitJobItemGetOutput(ProtoBuf.Meta.RuntimeTypeModel model)
        {
            ModProductBaseJobItemGetOutput obj;

            model.Add(typeof(ModProductBaseJobItemGetOutput), false).Add(
                nameof(obj.ObjectProduct),
                nameof(obj.ObjectsProductFeature),
                nameof(obj.ObjectsProductProductFeature),
                nameof(obj.ObjectProductCategory)
                );
        }
        private static void InitUserToken(ProtoBuf.Meta.RuntimeTypeModel model)
        {
            DataBaseObjectUserToken obj;

            model.Add(typeof(DataBaseObjectUserToken), false).Add(
                nameof(obj.LoginProvider),
                nameof(obj.Name),
                nameof(obj.UserId),
                nameof(obj.Value)
                );
        }
        private static void InitUserLogin(ProtoBuf.Meta.RuntimeTypeModel model)
        {
            DataBaseObjectUserLogin obj;

            model.Add(typeof(DataBaseObjectUserLogin), false).Add(
                nameof(obj.LoginProvider),
                nameof(obj.ProviderDisplayName),
                nameof(obj.ProviderKey),
                nameof(obj.UserId)
                );
        }
        private static void InitUserClaim(ProtoBuf.Meta.RuntimeTypeModel model)
        {
            DataBaseObjectUserClaim obj;

            model.Add(typeof(DataBaseObjectUserClaim), false).Add(
                nameof(obj.ClaimType),
                nameof(obj.ClaimValue),
                nameof(obj.Id),
                nameof(obj.UserId)
                );
        }
Exemple #7
0
        private static void InitDummyTree(ProtoBuf.Meta.RuntimeTypeModel model)
        {
            DataBaseObjectDummyTree obj;

            model.Add(typeof(DataBaseObjectDummyTree), false).Add(
                nameof(obj.Id),
                nameof(obj.ChildCount),
                nameof(obj.DescendantCount),
                nameof(obj.Level),
                nameof(obj.ObjectDummyMainId),
                nameof(obj.ParentId)
                );
        }
Exemple #8
0
        private static void InitDummyMain(ProtoBuf.Meta.RuntimeTypeModel model)
        {
            DataBaseObjectDummyMain obj;

            model.Add(typeof(DataBaseObjectDummyMain), false).Add(
                nameof(obj.Id),
                nameof(obj.Name),
                nameof(obj.ObjectDummyOneToManyId),
                nameof(obj.PropBoolean),
                nameof(obj.PropDate),
                nameof(obj.PropDateNullable),
                nameof(obj.PropDateTimeOffset),
                nameof(obj.PropDateTimeOffsetNullable),
                nameof(obj.PropDecimal),
                nameof(obj.PropDecimalNullable),
                nameof(obj.PropInt32),
                nameof(obj.PropInt32Nullable),
                nameof(obj.PropInt64),
                nameof(obj.PropInt64Nullable),
                nameof(obj.PropString),
                nameof(obj.PropStringNullable)
                );
        }
Exemple #9
0
        private static void InitUser(ProtoBuf.Meta.RuntimeTypeModel model)
        {
            DataBaseObjectUser obj;

            model.Add(typeof(DataBaseObjectUser), false).Add(
                nameof(obj.AccessFailedCount),
                nameof(obj.ConcurrencyStamp),
                nameof(obj.Email),
                nameof(obj.EmailConfirmed),
                nameof(obj.FullName),
                nameof(obj.Id),
                nameof(obj.LockoutEnabled),
                nameof(obj.LockoutEnd),
                nameof(obj.NormalizedEmail),
                nameof(obj.NormalizedUserName),
                nameof(obj.PasswordHash),
                nameof(obj.PhoneNumber),
                nameof(obj.PhoneNumberConfirmed),
                nameof(obj.SecurityStamp),
                nameof(obj.TwoFactorEnabled),
                nameof(obj.UserName)
                );
        }
 public static void RegisterParallelServices <T>(this ProtoBuf.Meta.RuntimeTypeModel rtm)
 {
     rtm.Add(typeof(ParallelServices_ListWrapper <T>));
     rtm.Add(typeof(ParallelServices_ArrayWrapper <T>));
 }
 /// <summary>
 /// Зарегистрировать.
 /// </summary>
 /// <param name="model">Модель.</param>
 public static void Register(ProtoBuf.Meta.RuntimeTypeModel model)
 {
     model.Add(typeof(DateTimeOffset), false).SetSurrogate(typeof(CoreCachingProtoBufDateTimeOffset));
 }
Exemple #12
0
        private static void MakeModel(Type type, TypeDescription description, ProtoBuf.Meta.RuntimeTypeModel model)
        {
            if (description is SimpleTypeDescription)
            {
                return;
            }
            if (description is BackReferenceTypeDescription)
            {
                return;
            }

            var nullable = description as NullableTypeDescription;

            if (nullable != null)
            {
                var underlying = Nullable.GetUnderlyingType(type);
                MakeModel(underlying, nullable.InnerType, model);

                return;
            }

            var list = description as ListTypeDescription;

            if (list != null)
            {
                var listI = type.GetListInterface();
                MakeModel(listI.GetGenericArguments()[0], list.Contains, model);

                return;
            }

            var dict = description as DictionaryTypeDescription;

            if (dict != null)
            {
                var dictI = type.GetDictionaryInterface();
                MakeModel(dictI.GetGenericArguments()[0], dict.KeyType, model);
                MakeModel(dictI.GetGenericArguments()[1], dict.ValueType, model);

                return;
            }

            var enumD = description as EnumTypeDescription;

            if (enumD != null)
            {
                var eT = model.Add(type, applyDefaultBehaviour: false);

                for (var i = 0; i < enumD.Values.Count; i++)
                {
                    eT.AddField(i, enumD.Values[i]);
                }

                return;
            }

            var classD = description as ClassTypeDescription;

            if (classD != null)
            {
                var cT = model.Add(type, applyDefaultBehaviour: false);

                var memNames = classD.Members.Keys.OrderBy(o => o, StringComparer.Ordinal).ToList();

                for (var i = 0; i < memNames.Count; i++)
                {
                    var mem = type.GetMember(memNames[i], BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).SingleOrDefault();

                    if (mem == null)
                    {
                        continue;
                    }

                    var field = cT.AddField(i + 1, memNames[i]);

                    var memType =
                        mem is PropertyInfo ?
                        ((PropertyInfo)mem).PropertyType :
                        ((FieldInfo)mem).FieldType;

                    MakeModel(
                        memType,
                        classD.Members[memNames[i]],
                        model
                        );
                }

                return;
            }

            throw new Exception("Unexpected description [" + description + "]");
        }
 public static ProtoBuf.Meta.TypeModel Compile(this ProtoBuf.Meta.RuntimeTypeModel model, string name, string path)
 {
     // dummy to avoid lots of test hackery for dll compilation tests
     model.CompileInPlace();
     return(model);
 }