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
1
vote
2 answers

MVC POCO Controllers and fluent routes

Is there any MVC framework around that applies POCO concept to controllers ? Example: Suppose I don't want to make my controller dependent on any web framework, in the way that I don't need to inherit from framework Controller class anymore.…
IlliakaillI
  • 1,510
  • 13
  • 25
1
vote
2 answers

Finding the right pattern for loading objects with different graphs

I'm trying to figure out the best way to handle loading objects with different graphs (related entities) depending on the context their being used. For example Here's a sample of my domain objects: public class Puzzle { public Id{ get; private…
Micah
  • 111,873
  • 86
  • 233
  • 325
1
vote
2 answers

Designing Fluent interface methods

I am trying to write a DSL I have methods that return strings but if I want to combine the strings I need to use a + symbol but I would like to call the methods together but I'm unsure how to achieve it I have methods at the moment such…
Jon
  • 38,814
  • 81
  • 233
  • 382
0
votes
1 answer

Fluent API for navigation property in the two ways

Classes public class ProductType { public Guid ID { get; set } public string Name { get; set } public ICollection Categories { get; set } } public class ProductCategory { public Guid ID { get; set } public…
ridermansb
  • 10,779
  • 24
  • 115
  • 226
0
votes
2 answers

Fluent WPF API for inherited properties

Occasionally I'll have some WPF C# code that I'd like to write in a "fluent" manner. For example, I might want to setup a Window containing a ScrollViewer: new Window() .SetContent( new ScrollViewer() .SetContent( …
dharmatech
  • 8,979
  • 8
  • 42
  • 88
0
votes
1 answer

Composite primary key in many-to-many relationship and column in code first

I guess this is covered somewhere but I'm not able to find. Guess I'm not using the correct search terms. Basically I have a Many-to-Many table that I define as POCO. You could then also look at it as a table with two one-to-many relations if you…
Ingó Vals
  • 4,788
  • 14
  • 65
  • 113
0
votes
1 answer

EF 4.1 Fluent API. How to map two entities while using an existing join table which has three id columns?

I have three entities (EntityA, EntityB, EntityC) in code and their respective tables (TableA, TableB, TableC) in the database. I also have an existing join table that has three ID columns(TableA_ID, TableB_ID, TableC_ID). In code, the entities are…
0
votes
1 answer

EF 4.2 Code first, how to delete many-to-many association?

I created a many-to-many relationship between two classes. public class Member { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid MemberId { get; set; } public string Name { get; set; } public virtual…
0
votes
2 answers

Entity Framework - Inheritance - Zero to one Relationship to child object, how to map? (Fluent API)

I have a Inheritance Hierarchy where Action is parent of ActionCompleted and ActionCancelled. Order class has a zero to one ActionCompleted and ActionCancelled. I have tried TPH and TPT (even tried edmx) but unable to get Entity to understand this…
0
votes
1 answer

Mapping ICollection using Fluent API

The FluentAPI can not create a relational model based on the code below: public class Project { public Guid ID { get; private set; } public string Name { get; set; } public virtual ICollection Images { get; set; } } public class…
ridermansb
  • 10,779
  • 24
  • 115
  • 226
0
votes
2 answers

What's the difference between 'with command' and 'fluent interface' in Delphi?

Why should I use fluent interface in Delphi instead of using 'with command'? I heard about both, but I haven't found the difference. I'm trying to find the best one for my project. ​It seems to work in the same way, just with some grammar…
0
votes
1 answer

How do you specify Cascade Delete for base tables using fluent api?

Question: How do I get EF 4.1 to specify the ON DELETE CASCADE option on the foreign key constraint using the fluent api for base tables? I know how to do it with relationships to other tables, but how do I have it generate this for TPT (Table Per…
0
votes
0 answers

One-to-many Primary /Foreign Key in Entity Framework

How to map one-to-many relationship on following entites using Fluent API. [Table("LU_COMMODITY_ID")] public class LU_COMMODITY_ID { [Key] public string COMMODITY_ID { get; set; } public virtual string COMMODITY_DESC { get; set; } …
0
votes
3 answers

c# how to make a conditional method chaining in fluent interface?

I'm developing .NET core app that using selenium, so I've designed the logic using fluent interface that make the code more readable and maintained. I have a problem which is how to make a conditional logic in pipeline I followed this link of…
0
votes
1 answer

Fluent Builder Interface lets me set middle name and last name more than once

I'm implementing a Fluent Builder Interface and instead of having null, empty or whitespace checks, I force the developer to fill in the following mandatory fields: firstName, prefix and facultyNumber. The other two fields middleName and lastName…
nop
  • 4,711
  • 6
  • 32
  • 93