Questions tagged [fluent-interface]

Refers to a practice of coding object-oriented APIs with the aim of improving readability of the interface, normally implemented using method chaining. The phrase was first coined by Eric Evans and Martin Fowler.

Martin Fowler's explanation on what he considers to be the proper way to design fluent interfaces can be found at http://www.martinfowler.com/bliki/FluentInterface.html.

Related concepts:

437 questions
0
votes
1 answer

Best way to exclude object from search with Fluent NHibernate Search

I have a class with a boolean property. I want to exclude instance with a false value from search result. What is the best way to do that with Fluent NHibernate Search ?
0
votes
1 answer

Claims athorization service API usability

Is the following API of a claims authorization service ok, from the point of view of usability? /* before UPDATE it was like this: var canEdit = Authz.ForNewRequest() .WithActionName("edit") .WithResourceName("project") …
0
votes
0 answers

Entity Framework - Mapped property will not populate, despite being retrieved by SQL

I'm trying to add a new sub-entity, product component ProductRevComp to an existing entity ProductRev. However when I retrieve an instance of the ProductRev class, the Comps collection is never populated (even when explicitly Including() it). I…
Visser
  • 188
  • 1
  • 10
0
votes
1 answer

php mvc model call function on data result

I've got a simple model: class Model { public function find($name) { return mysqli_query($con, 'select * from table where name = "'.$name.'"'); } public function first($rows) { foreach ($rows as $row) { …
dontHaveName
  • 1,899
  • 5
  • 30
  • 54
0
votes
2 answers

Jersey fluent API troubles

I'm rewriting some code because I had to upgrade to the latest version of Jersey (2.18) and I don't understand why the fluent API is working the way it does. Why does this compile: Response.Status.Family responseFamily = webTarget …
Joe Ernst
  • 508
  • 6
  • 18
0
votes
0 answers

Detection of fluent API use

Suppose I have the following data model: public class Base { public int Id { get; set; } public string Name { get; set; } } and the following OnModelCreating(): protected override void OnModelCreating(DbModelBuilder modelBuilder) { …
jdphenix
  • 15,022
  • 3
  • 41
  • 74
0
votes
1 answer

custom `id` name using `insertGetId` fluent method of Laravel

According to Laravel's documentation:Inserts Note: When using PostgreSQL the insertGetId method expects the auto-incrementing column to be named "id". So, is there a workaround for a custom id name while using inserGetId. i.e. $id =…
Nasif Md. Tanjim
  • 3,862
  • 4
  • 28
  • 38
0
votes
1 answer

inherit all the fluent interfaces

Let's say I have a class `A' with lot's of methods (which I can't grasp eventually) including a lot of fluent interfaces (including operator overloads) – returning *this by reference – which could become more in a later API version or so on. I'd…
0
votes
1 answer

Query base entity to retrieve all derived entity's data using Linq to Entities

I have following classes in my model: public class Party { public int Id {get; set;} } [Table("Person")] public class Person:Party { public string FirstName {get; set;} public string LastName {get;…
Masoud
  • 8,020
  • 12
  • 62
  • 123
0
votes
1 answer

Entity Framework - Fluent API Many-toMany

I have a constraint problem between two entities that I cannot seem to correct. Anyone see my error? 1. Street Address entity: public class StreetAddress : BaseEntity { // backing fields private ICollection _employees; public…
user1177440
0
votes
3 answers

How would i Build a mysql query through a set of PHP OOP methods?

I want to be able to do something like this: $table_object->getRows()->where($wer)->or($or)->orderBy('field', 'DESC'); If i were sure that all the methods will be called each time and in that order, then it would be simple and i can return an…
shxfee
  • 5,188
  • 6
  • 31
  • 29
0
votes
1 answer

How can I implement this schema using EF code-first? [Complex Composite Key combinations (multiple foreign tables)]

We have an existing database which we'd like to connect to using code-first EF. An issue we have come across is in the following scenario... **TABLE 1** DebtorID Int PK (identity column) Type Int PK FK ( value would be '1' - FK to Table 4) **TABLE…
0
votes
1 answer

Can you return a property of a POCO object from Linq by determining name of it?

Basic concept is I want to get a 'property' return from an input in a signature method. NOT the data behind the property. EG: If I select 'DEV' I want to get the POCO Class property called 'DEV' not data stored in a part of the POCO class. The…
djangojazz
  • 14,131
  • 10
  • 56
  • 94
0
votes
1 answer

Updated Castle to 3.2.1 from 3.0.0 now I cant use FirstNonGenericCoreInterface

After I upgraded Castle to 3.2.1 I cant seem to find the right replacement for FirstNonGenericCoreInterface My codes container.Register( AllTypes .FromAssemblyNamed("MySolution.Tasks") .InNamespace("MySolution.Tasks") …
0
votes
1 answer

EntityFramework Code First FluentAPI TPC

Here there are my domain entities: public class Province { private ICollection _cities; public virtual ICollection Cities { get { return _cities ?? (_cities = new HashSet()); } set { _cities = value; } …