Category: C#

MVC

simple ajax controller (for countries etc) ajax (these are research notes) consuming WebApi with MVC consuming WebApi with MVC Dynamic content in MVC/Razor the following contains xml entries to get past razor runtime compilation errors of namespace not found: @Html.LabelFor(model => model.path.Value, “Path”) @Html.DropDownList(“Path”, new List { new SelectListItem { Text = TypeSafeEnum.a.Value, Value = TypeSafeEnum.a.Value }, new SelectListItem {… Read more →

Text enums with the Entity Framework / Code First in C#

One of the projects I am working on requires enumerated values be text and not numeric. maritalStatus = ‘Single’ instead of maritalStatus = 1 Below is an example. All of the code is generated using TextTemplates. The enums are referenced in the POCOs like so: [XmlElement(ElementName=”maritalStatus”)] public MaritalStatus maritalStatus { get; set; } //Enum values are flattened in the xml… Read more →