Skip to content

Instantly share code, notes, and snippets.

View agilejon's full-sized avatar

Jon Dokulil agilejon

  • Cincinnati, OH
View GitHub Profile
// I have some list of things (typically IDs) that I want to do work on.
var fooIds = fooObjects.Select(f => f.FooId).ToList();
// #1
// This is my preference, because it's easier (for me) to spot the fact that we are taking some kind of important action.
// Examples 2 and 3 are easier to mis-read. At first glance I read them as somehow querying/filtering/modifying the list
// of ids, instead of as taking some kind of action on them.
foreach (var fooId in fooIds)
{
teamService.NotifyFooChanged(fooId);
// IFooDAO returns:
public class BaseFoo {
[BsonId]
public long _Id { get; set;}
}
// IFooService returns:
public class FooDTO {
public string FooId { get; set; }
}
public PlayCard GetClosestMatch(PlayCard playCard, long teamId)
{
try
{
var solr = SolrProxy.GetConnection<IndexedPlayCard>();
var playCardDataQueries = IndexedPlayCard.GetPlayCardDataQueries(playCard.Data);
if (!playCardDataQueries.Any()) return null;
var results = solr.Query(new SolrMultipleCriteriaQuery(playCardDataQueries), new QueryOptions
{