Exemple #1
0
        public async Task Populate(SuperModel model, string property)
        {
            var modelType    = model.GetType();
            var propertyInfo = modelType.GetProperty(property);

            if (propertyInfo?.GetCustomAttributes(typeof(HasManyAttribute), true).FirstOrDefault() is HasManyAttribute hasMany)
            {
                await processHasMany(model, modelType, propertyInfo !, hasMany);
            }
            else if (propertyInfo?.GetCustomAttributes(typeof(BelongsToAttribute), true).FirstOrDefault() is BelongsToAttribute belongsTo)
            {
                await processBelongsTo(model, modelType, propertyInfo !, belongsTo);
            }
        }