Exemple #1
0
        public static ReflectionEntityCache GetOrCreateEntity(Type type)
        {
            if (_entityCache.TryGetValue(type, out ReflectionEntityCache value))
            {
                return(value);
            }

            value = new ReflectionEntityCache(type);
            _entityCache.Add(type, value);

            return(value);
        }
Exemple #2
0
        public ReflectionPropertyCache GetProperty(string name)
        => Properties.FirstOrDefault(property =>
        {
            string propertyName = property.Name;

            if (property.IsForeignObj)
            {
                ReflectionEntityCache fk = GetOrCreateEntity(property.Type);
                propertyName             = $"{propertyName}{fk.PrimaryKey.Name}";
            }

            return(name == propertyName);
        });