This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Detailed Message: There was an error during job agent execution. The operation will be retried. Similar errors in the next five minutes may not be logged. | |
Exception Message: An item with the same key has already been added. (type ArgumentException) | |
Exception Stack Trace: at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) | |
at Microsoft.TeamFoundation.Framework.Server.TeamFoundationExtensionUtility.LoadExtensionTypeMap[T](String pluginDirectory) | |
at Microsoft.TeamFoundation.Framework.Server.JobApplication.SetupInternal() | |
at Microsoft.TeamFoundation.Framework.Server.JobServiceUtil.RetryOperationsUntilSuccessful(RetryOperations operations, Int32 maxTries, Int32& delayOnExceptionSeconds) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MetadataProvider : DataAnnotationsModelMetadataProvider | |
{ | |
private IConfigurationProvider _mapper; | |
public MetadataProvider(IConfigurationProvider mapper) | |
{ | |
_mapper = mapper; | |
} | |
protected override System.Web.Mvc.ModelMetadata CreateMetadata(IEnumerable<Attribute> attributes, Type containerType, Func<object> modelAccessor, Type modelType, string propertyName) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ValidatorProvider : DataAnnotationsModelValidatorProvider | |
{ | |
private IConfigurationProvider _mapper; | |
public ValidatorProvider(IConfigurationProvider mapper) | |
{ | |
_mapper = mapper; | |
} | |
protected override System.Collections.Generic.IEnumerable<ModelValidator> GetValidators(System.Web.Mvc.ModelMetadata metadata, ControllerContext context, IEnumerable<Attribute> attributes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return new StatusResult(View(ViewModel), “user created succesfully”); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return View(ViewModel).WithSuccessMessage(“user created succesfully”); | |
return RedirectToAction(“Index”).WithSuccessMessage(“user created succesfully”); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ActionResult Graph() { | |
var data = null; //todo load some data | |
return new PdfResult(data); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestMethod] | |
public void Login_Success() { | |
AuthenticationController controller = new AuthenticationController(); | |
ActionResult result = controller.Login(“user”, “123”); | |
Assert.IsTrue(result.GetType() == typeof(LoginResult)); | |
Assert.AreEqual(“user”, ((LoginResult)result).Username); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ActionResult Login(string username, string password) { | |
if(username != “user” || password != “123”) { | |
ModelState.AddError(“username or password incorrect”); | |
return View(); | |
} | |
return new LoginResult(username); //I typically pass the actual user into the login result | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ActionResult View(User entity) { | |
UserEditModel model = //change entity into a edit model | |
return View(model); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[AutoMap(typeof(EventListViewModel))] | |
public ActionResult Index(int? page) | |
{ | |
page = page ?? 1; | |
var entities = //load data from database | |
.AsPagination(page.Value, 20); //pagination method from MVC Contrib | |
return View(entities); | |
} |