public ColumnEntity Create(ISession session, CleanUp cleanUp, TableEntity table = null, string name = null, string datatype = null, string description = null) { table = table ?? (new TableEntityCreator()).Create(session, cleanUp); name = name ?? RandomTool.RandomString(20); datatype = datatype ?? RandomTool.RandomString(20); description = description ?? RandomTool.RandomString(20); var entityToSave = new ColumnEntity { DataType = datatype, Description = description, Name = name, ParentTable = table }; using (var transaction = session.BeginTransaction()) { session.Save(entityToSave); transaction.Commit(); cleanUp.AddForDeletion(entityToSave); } return entityToSave; }
public TableEntity Create(ISession session, CleanUp cleanUp, string name = null, string database = null, string description = null, string schema = null) { name = name ?? RandomTool.RandomString(20); database = database ?? RandomTool.RandomString(20); description = description ?? RandomTool.RandomString(20); schema = schema ?? RandomTool.RandomString(20); var tableToSave = new TableEntity { DatabaseName = database, Description = description, Name = name, SchemaName = schema }; using (var transaction = session.BeginTransaction()) { session.Save(tableToSave); transaction.Commit(); cleanUp.AddForDeletion(tableToSave); } return tableToSave; }