public override bool Equals(object obj)
        {
            EnsureSchemaResult compareTo = obj as EnsureSchemaResult;

            if (compareTo != null)
            {
                return(Database.Equals(compareTo.Database) && SchemaName.Equals(compareTo.SchemaName));
            }
            return(base.Equals(obj));
        }
Exemple #2
0
        /// <summary>
        /// Creates the tables for the specified type
        /// </summary>
        /// <param name="type"></param>
        public static EnsureSchemaStatus EnsureSchema(Type type, Database database = null)
        {
            string             name   = Dao.ConnectionName(type);
            Database           db     = database ?? Db.For(type);
            EnsureSchemaResult result = new EnsureSchemaResult {
                Database = db, SchemaName = name
            };
            EnsureSchemaStatus status = _ensureSchemaResults.Where(esr => esr.Equals(result)).Select(esr => esr.Status).FirstOrDefault();

            if (status != EnsureSchemaStatus.AlreadyDone ||
                status != EnsureSchemaStatus.Success)
            {
                _ensureSchemaResults.Add(result);
                status = db.TryEnsureSchema(type);
            }
            else
            {
                status = EnsureSchemaStatus.AlreadyDone;
            }
            result.Status = status;
            return(status);
        }