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
3
votes
1 answer

Fluent Mappings / Data Annotations for Unique columns and navigation properties with differant names in Entity Framework 4.1?

First, is there a way to tell EF 4.1 that a column needs to be unique by using either data annotations or the fluent API? Second, regarding navigation properties, I have have 2 classes Document and User. In the document class I have a property for…
DDiVita
  • 4,225
  • 5
  • 63
  • 117
3
votes
2 answers

Code Contracts and Fluent API with EF Code First Sample

Consider the following code snippet: public partial class DatabaseContext : DbContext { protected override void OnModelCreating(DbModelBuilder modelBuilder) { Contract.Assume(modelBuilder != null); …
3
votes
2 answers

which of the three fluent expressions below best matches the user story?

I am working on a fluent framework, and I was looking to get some feedback from other engineers as to which fluent expression is the most aligned with the user story that I have. User Story: "as a software engineer using fluent framework X, when…
CedricB
  • 1,157
  • 9
  • 23
3
votes
2 answers

EF4 CodeFirst CTP5 nvarchar(max) via attribute

Is there a way to create a custom attribute that will make EF CodeFirst use nvarchar(max) as datatype when assigned to a property of a poco class? I know this is possible via fluent api, but we would like to have all definitions within one place and…
3
votes
4 answers

How far is too far with fluent C#?

public static class Th { public static T e(T theObject) where T : class { return theObject; } } public static class ObjectExtensions { public static bool Is(this T o, Func a) where T : class { …
Ben Aston
  • 53,718
  • 65
  • 205
  • 331
3
votes
1 answer
3
votes
8 answers

Separate decode/encode interfaces or in one interface

I'm creating an implementation that performs conversion from one form to another. The design problem I am facing now is whether the Encoder and Decoder API should be in one interface or in separate ones. e.g. Apache MINA uses separate interfaces I…
ashitaka
  • 3,928
  • 7
  • 38
  • 43
3
votes
6 answers

Converting an XML document to fluent C#

I'd like to convert an external XML document without any XSD schema associated with it into a fluent .NET object. I have a simple XML file like:
Ronnie
  • 4,959
  • 10
  • 51
  • 69
3
votes
3 answers

Difference between method chaining and fluent interface

I wanted to know the exact difference between method chaining and fluent interface. As I understand it, method chaining is just running the methods of previous method return objects while avoiding temporary variables. An example of this could be…
3
votes
6 answers

OOP problem: Extending a class, override functions and jQuery-like syntax

I have an OOP related problem with Flash, actionscript 3. It's a personal project, and I am looking for a design pattern or workaround for this problem, and my goal is to learn new things. I have created a class called Chain. I created this…
Mark Knol
  • 9,663
  • 3
  • 29
  • 44
3
votes
3 answers

Mapping properties to (differently named) foreign key fields in Entity Framework CTP5

I'm trying to use the Entity Framework CTP5 Fluent API to map an exist database. I have the following classes: public class Shop { public long Id { get; set; } } public class Sale { public long Id { get; …
3
votes
1 answer

How do I cascade deletes into a link table using the EF4 fluent API?

I have two tables in an existing (MSSQL 2008 R2) database that are related by a link table. The two tables are "Plan" and "Tips". The link table is "PlanTipLinks". Plans can have many tips, and tips can be associated with multiple plans (i.e. it's a…
3
votes
2 answers

How to Write Generic Extension Method to Convert Type in C#

I am writing a static guard class/api to validate parameters sent to methods. Code so far looks like: public static class Guard { public static GuardArgument Ensure(T value, string argumentName) { return new…
Graham
  • 1,497
  • 2
  • 16
  • 36
3
votes
1 answer

Eclipse plugin for Fluent API methods

I'm looking for an eclipse plugin that can generate fluent API methods in my beans. For instance, given this bean: public class MyBean { private String name; private int age; //Setters and getters } Is there any eclipse plugin that…
jfcorugedo
  • 9,793
  • 8
  • 39
  • 47
3
votes
3 answers

How are fluent API's different from other API's?

I have come across fluent API's while studying DSLs. I have searched a lot on fluent API's...the basic conclusion which I could draw was that fluent a API uses method chaining in order to make the code fluent. But I cannot understand - in object…
intern
  • 141
  • 1
  • 6