Creating API that is fluent

This article explains it much better than I ever could. EDIT, can’t squeeze this in a comment… There are two sides to interfaces, the implementation and the usage. There’s more work to be done on the creation side, I agree with that, however the main benefits can be found on the usage side of things. … Read more

Laravel – Eloquent or Fluent random row

Laravel >= 5.2: User::inRandomOrder()->get(); or to get the specific number of records // 5 indicates the number of records User::inRandomOrder()->limit(5)->get(); // get one random record User::inRandomOrder()->first(); or using the random method for collections: User::all()->random(); User::all()->random(10); // The amount of items you wish to receive Laravel 4.2.7 – 5.1: User::orderByRaw(“RAND()”)->get(); Laravel 4.0 – 4.2.6: User::orderBy(DB::raw(‘RAND()’))->get(); Laravel … Read more

Implementing Zero Or One to Zero Or One relationship in EF Code first by Fluent API

By changing pocos to: public class Order { public int OrderId { get; set; } public virtual Quotation Quotation { get; set; } } public class Quotation { public int QuotationId { get; set; } public virtual Order Order { get; set; } } and using these mapping files: public class OrderMap : EntityTypeConfiguration<Order> { … Read more