Ejemplo n.º 1
0
        private void RegisterFieldMetadata(ModelProperty property, FieldMetadata metadata, ForeignKeyFieldMetadata viaForeignKey, IConverter converter)
        {
            base.RegisterFieldMetadata(property, metadata, converter);

            var tableName = GetTableName(metadata.FieldName);

            ITinyDictionary <ForeignKeyFieldMetadata, List <int> > tableMetadata;

            if (!_tableMetadata.TryGetValue(tableName, out tableMetadata))
            {
                tableMetadata  = EmptyTinyDictionary <ForeignKeyFieldMetadata, List <int> > .Instance;
                _tableMetadata = _tableMetadata.AddOrUpdate(tableName, tableMetadata);
            }

            List <int> tableProperties;

            if (!tableMetadata.TryGetValue(viaForeignKey, out tableProperties))
            {
                tableProperties = new List <int>();
                tableMetadata   = tableMetadata.AddOrUpdate(viaForeignKey, tableProperties);
                _tableMetadata.AddOrUpdate(tableName, tableMetadata);
            }

            tableProperties.Add(property.Key);

            _queryString = null;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Registers metadata for a <see cref="ModelProperty"/>.
 /// </summary>
 /// <param name="property">Property to register metadata for.</param>
 /// <param name="metadata">Metadata for the field on the related object.</param>
 /// <param name="viaForeignKey">Metadata for the ForeignKey column on the primary object that maps to the related object.</param>
 protected void RegisterFieldMetadata(ModelProperty property, FieldMetadata metadata, ForeignKeyFieldMetadata viaForeignKey)
 {
     RegisterFieldMetadata(property, metadata, viaForeignKey, null);
 }