Skip to content

Commit

Permalink
Use Resources for Exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert McLaws (Microsoft MVP) authored Dec 24, 2016
1 parent 4c0015b commit 35ff71c
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,10 @@ public Task<IEdmModel> GetModelAsync(ModelContext context, CancellationToken can
// @robertmclaws: In this case, we have multiple DbContexts available, but none of them match up.
// Tell the user what we have, and what we were expecting, so they can fix it.
var containerNames = efEntityContainers.Aggregate("", (current, next) => next.Name + ", ");
throw new Exception("This project has multiple EntityFrameworkApis using different DbContexts, and the correct context could not be loaded. \r\n" +
$"The contexts available are '{containerNames.Substring(0, containerNames.Length - 2)}' but the Container expects '{efEntityContainer.Name}'.");
throw new Exception(string.Format(Resources.MultipleDbContextsExpectedException, containerNames.Substring(0, containerNames.Length - 2), efEntityContainer.Name));
}
// @robertmclaws: In this case, we only had one DbContext available, and if wasn't thw right one.
throw new Exception("Could not find the correct DbContext instance for this EntityFrameworkApi. \r\n" +
$"The Context name was '{dbContext.GetType().Name}' but the Container expects '{efEntityContainer.Name}'.");
throw new Exception(string.Format(Resources.DbContextCouldNotBeFoundException, dbContext.GetType().Name, efEntityContainer.Name));
}
var itemCollection = (ObjectItemCollection)efModel.GetItemCollection(DataSpace.OSpace);

Expand Down

0 comments on commit 35ff71c

Please sign in to comment.