MicroLite.Mapping.TableInfo.TableInfo C# (CSharp) Method

TableInfo() public method

Initialises a new instance of the TableInfo class.
Thrown if columns or name are null. Thrown if no there is a problem with the column mappings.
public TableInfo ( IList columns, IdentifierStrategy identifierStrategy, string name, string schema ) : System
columns IList The columns that are mapped for the table.
identifierStrategy IdentifierStrategy The identifier strategy used by the table.
name string The name of the table.
schema string The database schema the table exists within (e.g. 'dbo'); otherwise null.
return System
        public TableInfo(
            IList<ColumnInfo> columns,
            IdentifierStrategy identifierStrategy,
            string name,
            string schema)
        {
            if (columns == null)
            {
                throw new ArgumentNullException("columns");
            }

            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            this.columns = new ReadOnlyCollection<ColumnInfo>(columns);
            this.identifierStrategy = identifierStrategy;
            this.name = name;
            this.schema = schema;

            this.identifierColumn = columns.FirstOrDefault(c => c.IsIdentifier);

            this.insertColumnCount = columns.Count(c => c.AllowInsert);
            this.updateColumnCount = columns.Count(c => c.AllowUpdate);

            this.ValidateColumns();
        }