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

EF5 Code First GUIDs with MySQL

I'm sure that I'm just missing something obvious but I can't seem to get the following code to function correctly. This is one of my POCO classes that uses a Guid: public class Player { public virtual Guid PlayerID { get; set; } public…
Arcadian
  • 1,373
  • 4
  • 20
  • 30
0
votes
1 answer

Map entities to many-to-many junction table in EF 4.5

At the moment I’m mapping my existing DB tables to new EF 4.5 model via Fluent Api. I’ve got a questing on how to map following db structure to classes. Students(pk Id...) Courses (pk Id...) Students_Courses (pk Id, fk StudentId, fk…
Bashir Magomedov
  • 2,841
  • 4
  • 28
  • 44
0
votes
1 answer

Entity Framework - Foreign key in sub-object

I am working with Entity Framework to retrive blog data from a database. I have a class "BlogPost" and a class "Author". One Author may have many blog posts, but the Author object itself does not contain a list of them. As far as the Author object…
Levi Botelho
  • 24,626
  • 5
  • 61
  • 96
0
votes
2 answers

Adding properties to an object using a fluent interface

I have a class like below: $structure = new stdClass(); $structure->template->view_data->method = 'get_sth'; $structure->template->view_data->lang = $lang; $structure->template->view_data->id_page =…
user1031030
0
votes
1 answer

Need clarification on Entity Framework Code-First and Navigation Properties and Scalar Keys

As I understand it (so please correct me if I am mistaken), entity classes that have relationships between them can be defined in several ways -- (1) by using both a property to represent a scalar key plus a navigation property or (2) just using a…
Jason
  • 2,806
  • 2
  • 28
  • 38
0
votes
2 answers

NHibernate: Deleting a collection and re-inserting

I have a User with related Permissions. Here is what I want: I create a User and add a permission to the User.Permissions collection. It gets saved and everything happens as expected. Then I edit the user and remove the permission. A new user…
Eben
0
votes
1 answer

EF Many to Many Relationship on 3 Tables(Fluent API)

I have 3 tables that needs to be combined in one table. On below you can see the codes. The problem is each player could play on one or more team on each tournament. Players and teams arranger by every new tournament. So how can i map it with…
0
votes
1 answer

.NET Fluent code design best practices

Today I tried to make some fluent interface for my OpenXml Spreadsheet Cell. And I wrote this one: http://pastebin.com/64dZ8ji7 This could be used as: var newCell = _cell.For.Column(1).For.Row(1).WithContent("Hello").Create(); My question is in…
Akim Khalilov
  • 1,019
  • 4
  • 16
  • 31
0
votes
1 answer

one to one relationship with fluent api

Model: public class User { public Guid UserId { get; set; } public string UserName { get; set; } public virtual Membership Membership { get; set; } } public class Membership { public Guid UserId { get; set; } public DateTime…
theStig
  • 612
  • 1
  • 13
  • 33
0
votes
1 answer

Providing an easy interface/console for our application's DSL

We have an application that serves as a simulator for a type of agent in a distributed system. Its intended use is for integration testing and thus it has to be very flexible. We have a fluent interface, that might evolve into an internal DSL, for…
0
votes
1 answer

IronPython DSL casting constants to C# types

I am implementing a DSL in IronPython. Suppose I have a value hierachy implemented in C# to be used in iron python: public abstract Value { } public abstract DoubleValue : Value { // Constructors... public double magnitude; …
user1275011
  • 1,552
  • 1
  • 16
  • 36
0
votes
1 answer

Progressing fluent interfaces how can I hide all methods but one at the start?

Trying to create a simple noddy example so that I can build my next project using fluent interfaces. I need to provide the user of my dll with an intuitive step by step way of building a class. Question. I would like the user only to see Initialise…
user9969
  • 15,632
  • 39
  • 107
  • 175
0
votes
1 answer

Fluent API Composite Foreign Key with Generic Object Type

I have an Organization class and a User class as follows, & I want to be able to assign an Address to each individually - without having the need for two separate many-to-many tables for AddressUser & AddressOrganization, AddressAnything, etc. The…
-1
votes
1 answer

Immediately calling destructor after setting in the fluent interface in C++

I want to create a class only for setting params for function. I'm using a fluent interface for that. Some function returns the object to setting params and real code will execute in the destructor of this object. First of all, is it a good idea? Is…
User98
  • 31
  • 6
-1
votes
3 answers

In jQuery, can I use functions instead of CSS selectors?

Rather than use $('.list').find('li:not(.done):last'), which returns all LI that is not .done and is the last of every .list, how can I use functions instead? For instance, $('.list').find('li').not('.done').last() would return just one item,…
Gary
  • 3,891
  • 8
  • 38
  • 60
1 2 3
29
30