И как-то так
Я объясню немного дальше. (И исправьте глупые ошибки: S)
//Interface to be able to which classes are able to give a boolean result used in the if stuff
public interface IResultable
{
bool Result();
}
//A list that is IResultable itself it gathers the results of the IResultables inside.
public class ComparatorList<T> : List<T>, IResultable where T : IResultable
{
public bool Result()
{
bool retval = true;
foreach (T t in this)
{
if (!t.Result())
{
retval = false;
}
}
return retval;
}
}
//Or two bools
public class OrComparator : IResultable
{
bool left;
bool right;
public OrComparator(bool left, bool right)
{
this.left = left;
this.right = right;
}
#region IResultable Members
public bool Result()
{
return (left || right);
}
#endregion
}
// And two bools
public class AndComparator : IResultable
{
bool left;
bool right;
public AndComparator(bool left, bool right)
{
this.left = left;
this.right = right;
}
#region IResultable Members
public bool Result()
{
return (left && right);
}
#endregion
}
// compare two ints
public class IntIsComparator : IResultable
{
int left;
int right;
public IntIsComparator(int left, int right)
{
this.left = left;
this.right = right;
}
#region IResultable Members
public bool Result()
{
return (left == right);
}
#endregion
}
Есть ли у вас много там, если заявления это может быть круто:)
Итак, у нас есть такая структура для проведения большого количества сравнений , Я приведу небольшой пример реализации.
//list of ands
ComparatorList<AndComparator> ands = new ComparatorList<AndComparator>();
ands.Add(new AndComparator(true,true));
//list of ors
ComparatorList<OrComparator> ors = new ComparatorList<OrComparator>();
ors.Add(new OrComparator(false, true));
//list of intiss
ComparatorList<IntIsComparator> ints = new ComparatorList<IntIsComparator>();
ints.Add(new IntIsComparator(1, 1));
//list of all things :)
ComparatorList<IResultable> collected = new ComparatorList<IResultable>();
collected.Add(ands);
collected.Add(ors);
collected.Add(ints);
// if all things are as they must be :)
if (collected.Result())
{
//Evertything is as it schould be :)
}
What's the deficiency with SQL Server Database Diagrams?
In any case, my surprising recommendation would be to try Sparx Enterprise Architect. While not primarily a database tool, it can reverse-engineer a database into an ER model, then you can create one or more diagrams from that model. It has a nice "Add Related Elements" command that allows you to create a new diagram to focus on one entity; drag the one entity onto the diagram; then add just those other entities related to the first.
You can also customize the level of detail displayed on the diagrams, and print the diagrams as one or multiple pages.
Oh, and it does UML as well.
Все, что больше двадцати или около того таблиц, всегда будет трудно представить в виде диаграммы и быть полезным / удобным для пользователя.
Вам следует взглянуть на следующий вопрос, который задают сегодня:
Как сделать диаграмму ER с 500 таблицами? (SO)
Как сделать диаграмму ER с 500 таблицами? (Мой ответ)
Общее мнение / консенсус состоит в том, чтобы не пытаться использовать одну большую диаграмму, а разбить базу данных на несколько диаграмм меньших управляемых групп таблиц (например, на основе функциональности или какой-либо другой взаимосвязи).
Кев