public void initializeCollection(string connectionString) { if (!SqlHelper.ExistTable(_collectionName, connectionString)) { SqlHelper.CreateTable(_collectionName, EntityFields, connectionString); } else { //recuperamos todos los campos de la tabla IList <DbField> dbFields = SqlHelper.InitializeCollectionFields(_collectionName, connectionString); //si falta algun campo lo añadimos foreach (EntityField entityField in EntityFields) { if (!dbFields.Any(x => x.Name == entityField.Name) && !String.IsNullOrEmpty(entityField.DbType)) { SqlHelper.AddField(_collectionName, entityField.Name, entityField.DbType, entityField.IsNullable, connectionString); } } } }