Код: Выделить всё
[Flags]
public enum ItemTags { Browsable = 2, InMenu = 4 }
public List GetAllItems(ItemTags flags)
{
// Here I should create the SQL bitwise query.
}
Код: Выделить всё
select * from tableName where columnName & 2 = 2 and columnName & 4 = 4
Код: Выделить всё
public List GetItemsOfMenu()
{
return repository.GetAllItems(ItemTags.InMenu);
}
public List GetBrowsableItems()
{
return repository.GetAllItems(ItemTags.Browsable);
}
public List GetBrowsableMenuItems()
{
return repository.GetAllItems(ItemTags.Browsable & ItemTags.InMenu);
}
Подробнее здесь: https://stackoverflow.com/questions/658 ... -sql-query
Мобильная версия