488 karma · joined Nov 5, 2013 (13y ago) · 203 submissions
comment 11y ago · link · parent
I do not need a woman to be happy. I do not need a woman to have children. There are plenty of children in need of a parent already (even if that is a single parent). Save for your own retirement and enjoy life.
comment 12y ago · link · parent
netsh http add urlacl url=http://+:8080/ user=DOMAIN\username
You don't need attributes based routing in this example. Convention based routing is built into WebAPI.For the Delete method you can return an HttpStatusCode instead of throwing an exception.
public IHttpActionResult Delete(int Id)
{
var result = (from b in ourbooks
where b.Id == Id
select b).FirstOrDefault();
ourbooks.Remove(result);
return StatusCode(HttpStatusCode.Accepted);
}
Also check out the OWIN self host tutorial [2].[1] https://github.com/NancyFx/Nancy/wiki/Hosting-nancy-with-owi...
[2] http://www.asp.net/web-api/overview/hosting-aspnet-web-api/u...
comment 12y ago · link · parent
First add foreign keys to to models (e.g. In the Build class add MainlineID for the Mainline object).
Then you can define the configuration:
Public Class BuildConfiguration
Implements EntityTypeConfiguration(Of Build)
Public Sub New()
ToTable("Build")
' Other mappings
' Define one-to-many
HasRequired(Function(x) x.Mainline) _
.WithMany(Function(x) x.Builds) _
.HasForeignKey(Function(x) x.MainlineID)
End Sub
End Class
Inside your context you load the configuration: Public Class MyContext
Inherits DbContext
Public Property Builds As DbSet(Of Build)
Protected Overrides Sub OnModelCreating(modelBuilder As DbModelBuilder)
MyBase.OnModelCreating(modelBuilder)
modelBuilder.Configurations.Add(New BuildConfiguration())
End Sub
End Class
Then you can use the Include extension method (or eager loading) on the DbContext to populate the object. Using context As New MyContext()
Return context.Builder.Include(Function(b) b.Mainline)
End Using
See also:http://weblogs.asp.net/manavi/archive/2011/05/17/association...
comment 12y ago · link · parent
I wonder whether we will be seeing a .NET web server for mac and linux. Hosting a C# MVC app on linux will be sweet.
comment 12y ago · link · parent