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

Fluent API with "static" class in java

I have a "static" class (i.e. a class with a private constructor and only static members and functions). It wraps Androids' SharedPreferences Editor which has a rather nice fluent API. I was wondering if it was at all possible to create a similar…
Oren
  • 4,152
  • 3
  • 30
  • 37
1
vote
1 answer

Does DELETE CASCADE Option for Foreign Keys delete grandchildren?

pretty new to SQL cascading delete. I was wondering how cascade delete works when it comes the children. So say I have a table situation like: ParentTable ==Cascade==> ChildTable ==NoCascade==> GrandChildTable Will the grandchild also be deleted?…
1
vote
1 answer

EF Doesn't Delete Records For Fluent API - Many To Many Relationship

I have 2 entities, News FileAttachment I wanted to configure using code-first fluent API so that Each News can have 0,1 or more than 1 attachments. here is what i'm using right now public NewsMap() { this.ToTable("News"); // Table…
1
vote
1 answer

Mapping relationships in existing database with EF

I am using an existing database that I am unfortunately unable to change, and seem to be having trouble creating a relationship. I'm relatively new to EF, and after some searches have found users trying to achieve something similar, however the…
1
vote
1 answer

How to map complex one-to-many with Entity Framework and Fluent API

I'm coming from Java and is now implementing an existing system into a database with C# and Entity Framework. Since I cannot show the actual classes here, I've tried to make an example identical to my problem, which is as follows. I have a Company…
jonas
  • 1,592
  • 3
  • 20
  • 29
1
vote
0 answers

Entity framework Code First and Fluent API have a difficulty with using type decimal?

I need help! When I read a decimal value of the DB it returns a different value for C#. For example: In DataBase the value is 0.0000 and in C# code the value read is 0.1200. I need to know what is wrong not find anywhere. Below follows the code: C#…
1
vote
1 answer

Issue With Fluent Nhibernate Automapping and Guids / UniqueIdentifiers as Primary Key Fields

I am attempting to use the Fluent-NHibernate automapping functionality (in the latest version of the software) and am running into problems using Guids as the Primary Key fields. If I use integer fields for the primary keys, the tables are generated…
1
vote
2 answers

Multi-level inheritance with fluent interface in C#

Given the sample console application below: QUESTION #1: Why does .Name() return typeof OranizationBuilder, but .Write() calls CorporationBuilder? QUESTION #2: How to get .Name() to return typeof CorporationBuilder? namespace MyCompany { using…
jlang
  • 157
  • 1
  • 1
  • 9
1
vote
1 answer

Entity Framework and using Fluent API for mapping two entities to another one

Scenario seems to be trivial and I'm really confused on what I'm doing wrong. So, I have a Client class public class Client { [Key] public int ClientID { get; set; } public string FirstName { get; set; } public string LastName {…
Paweł Staniec
  • 3,151
  • 3
  • 29
  • 41
1
vote
2 answers

Cannot define composite PK with Fluent API in VB.NET

I am trying to define a composite PK for a class where one of the columns is a FK to another table. The code compiles without any errors but when I try to migrate the changes I get the following error PM> Update-Database -Force…
Jason
  • 2,806
  • 2
  • 28
  • 38
1
vote
2 answers

Adding New Column to Mapped Table using Fluent API

I have two entities as below: public class Project { public int ID { get; set; } public string ProjectName { get; set; } } public Class FourteenSteps { public int ID { get; set; } public string StepName { get; set; } } I want to…
Balaji Telugunti
  • 53
  • 1
  • 3
  • 10
1
vote
0 answers

EF 5 mapping relation mapping with fluent API

These are tables, the fields end with * are PK. In the Image table one of the HomeID or CarID must have the value and the other one is null. Similar to this in the Feature they are 0 instead of null so can use it as a Key (this.HasKey). But When I…
Onur Topal
  • 3,042
  • 1
  • 24
  • 41
1
vote
2 answers

Emulating fluent interfaces in bash

In bash, is there some way (which may even resort to using eval) to emulate a fluent interface, something like expect 3 to_be 4 where expect and to_be are functions? Or is there at least some way to nest function calls, something like expect to_be…
helpermethod
  • 59,493
  • 71
  • 188
  • 276
1
vote
1 answer

Castle Interceptors With Fluent Interface

I'm trying to get an interceptor I've written to work, but for some reason it doesn't seem to be instantiating the interceptor when I request my components. I'm doing something like this (forgive me if this doesn't quite compile, but you should get…
jonnii
  • 28,019
  • 8
  • 80
  • 108
1
vote
1 answer

Does this DSL for my DI container make sense?

Since I'm not a native English speaker I better make sure not to create an DSL that would sound awkward for others. A DI container emerged out of a project and I'm isolating it as a seperate project. I see other DI/IOC containers using syntax like…
koen
  • 13,349
  • 10
  • 46
  • 51