Exemple #1
0
        public CypherTypeItem AddKeyAttribute <TEntity, TAttr>(ICypherExtensionContext context, TEntity entity)
            where TAttr : CypherExtensionAttribute
            where TEntity : class
        {
            var type = entity.GetType();
            var key  = new CypherTypeItem {
                Type = type, AttributeType = typeof(TAttr)
            };

            //check cache
            if (!_typeProperties.ContainsKey(key))
            {
                //strip off properties create map for usage
                _typeProperties.AddOrUpdate(key, type.GetProperties().Where(x => x.GetCustomAttributes(typeof(TAttr), true).Any())
                                            .Select(x => new CypherProperty {
                    TypeName = x.Name, JsonName = x.Name.ApplyCasing(context)
                })
                                            .ToList(), (k, e) => e);
            }
            return(key);
        }
Exemple #2
0
 public void AddPropertyUsage(CypherTypeItem type, List <CypherProperty> properties)
 {
     _typeProperties.AddOrUpdate(type, properties, (item, list) => properties);
 }
 internal static void AddConfigProperties(CypherTypeItem type, List <CypherProperty> properties)
 {
     CypherTypeItemHelper.AddPropertyUsage(type, properties);
 }