/// <summary> /// Constructs a SchemaObject of the given type, name, and sql script /// </summary> /// <param name="type">The type of the SchemaObject</param> /// <param name="name">The name of the SchemaObject</param> /// <param name="sql">The SQL script for the SchemaObject</param> /// <remarks>The type and name must match the SQL script.</remarks> /// <exception cref="ArgumentNullException">If name or sql is null</exception> internal SchemaObject (SchemaObjectType type, string name, string sql) { if (name == null) throw new ArgumentNullException ("name"); _type = type; _sql = sql; _implementation = SchemaImpl.GetImplementation(_type, name, _sql); }
/// <summary> /// Create a SchemaObject from a sql snippet, attempting to detect the type and name of the object /// </summary> /// <param name="sql">The sql to parse</param> /// <exception cref="SchemaParsingException">If the SQL cannot be parsed</exception> public SchemaObject (string sql) { _sql = sql; var name = ParseSql(); _implementation = SchemaImpl.GetImplementation(_type, name, _sql); }