예제 #1
0
        private SourceTablePairing GetNamesIfHasSourceTable <TEnum>()
        {
            var Result = new SourceTablePairing();

            var Names = Enum.GetNames(typeof(TEnum));
            var type  = typeof(TEnum);
            var attr  = type.GetTypeInfo().GetCustomAttributes(typeof(SourceTableAttribute), false).ToList();

            if (attr.Count() > 0)
            {
                Result.TableName       = ((SourceTableAttribute)attr[0]).Name;
                Result.EnumerationName = type.Name;
                Result.Names           = Names.ToList();
            }

            return(Result);
        }
예제 #2
0
        private void DynamicFillTriplets(SourceTablePairing pairing)
        {
            if (pairing.Names.Count > 0)
            {
                foreach (var name in pairing.Names)
                {
                    var Triplet = context.Set <EnumTriplet>()
                                  .FromSql($"GetEnumTriplet @p0, @p1", pairing.TableName, name)
                                  .AsNoTracking()
                                  .ToList();

                    if ((Triplet != null) && (Triplet.Count >= 1))
                    {
                        var Result = Triplet.FirstOrDefault();
                        Result.EnumerationName = pairing.EnumerationName;
                        _EnumLookups.Add(Result);
                    }
                }
            }             // if we found it in the database
        }