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

How does Greg Young's Fluent Interface work?

I'm trying to follow along this article: http://codebetter.com/gregyoung/2007/12/05/a-use-for-extension-methods/ I follow along fine up to this point: Now that I have these I can decorate the Builder with extension methods like: public static…
ton.yeung
  • 4,793
  • 6
  • 41
  • 72
0
votes
0 answers

EF 5, Fluent API : invalid column name "Source_ID"

Good morning I Get invalid column name "Source_ID". my models are : product: public int ID { get; set; } public string Name { get; set; } public string Description { get; set; } public decimal Price { get; set; } public Nullable
NOr
  • 1,043
  • 2
  • 11
  • 13
0
votes
1 answer

Entity Framework, Code First Foreign Key Mapping Error

I am having the hardest time figuring the right configuration for mapping a foreign key "Category" to my "Products" table. When the model is being generated (Code First), I am getting this internal exception message. {"Unable to determine the…
Jeff Pearce
  • 581
  • 7
  • 15
0
votes
1 answer

code first database model

I'm trying to create a MVC3 application, i'm troubled with EF code first to create DB. I have this tables: User, Category, Product, Loan. A User can create none or more Categories. A User can add none or more Products. A User can add none or more…
Morar Mihai
  • 77
  • 1
  • 2
  • 7
0
votes
0 answers

Conditional Mapping of POCO entities using Fluent API

I have this POCO class : public class MyClass { public int MyKey { get; set; } public string Name { get; set; } public bool DiscriminatorField { get; set; } public string AnotherInfo { get; set; } } My database model is as such…
Tipx
  • 7,367
  • 4
  • 37
  • 59
0
votes
1 answer

nhibernate foreign key relationship on between two natual key columns

I want to define foreign key relationship between two tables using natural keys... By default nhibernate is considering the other column as primary key... Class A{ public virtual int id {get; set;} public virtual int username {get;…
0
votes
1 answer

EF Map One To Many Composite PK - No PK Property on Child Class

Check at the following Db Scripts: CREATE TABLE tlogdata ( logentryid INT NOT NULL, -- PK [key] NVARCHAR(25) NOT NULL, -- PK value NVARCHAR(MAX) NOT NULL ) CREATE TABLE tlogentry ( logentryid INT IDENTITY(1,1) NOT NULL, -- PK …
rzumbado
  • 99
  • 6
0
votes
2 answers

Dynamically Return Interface at Design-Time

I'm attempting to write a fluent interface which is able to, at design time, detect the property type being passed as a Linq Expression and return an interface based on an evaluation of that type. For example: public class Searchable { …
John Hurrell
  • 350
  • 4
  • 11
0
votes
1 answer

A conflict in exposing a foreign key as a property during mappings

I have the following table structure: Affiliations Id Party1 Party2 1 100 200 2 300 400 And a table referenced through the FKs of Affiliations Parties Id Name 100 Hank 200 Ted 300 Kim 400 Joe Using my Party…
George Johnston
  • 31,652
  • 27
  • 127
  • 172
0
votes
1 answer

arg array of Expression> as part of a fluent interface

Consider an interface like this: new Provider().For(myClass).ExcludeProperties("Height", "Width"); public IEditableStateProvider For(object target) {...} public IEditableStateProvider ExcludePropertyNames(params string[] propertyNames) {...} I…
Berryl
  • 12,471
  • 22
  • 98
  • 182
0
votes
1 answer

Enterprise Library Exception Handling "Process" method

I have a question on using Enterprise Library Exception Handling Application Block. First is the "ExceptionManager.Process" method. what I understood from the documentation is that you can execute your desired method and if it has an exception the…
Pouyan
  • 2,849
  • 8
  • 33
  • 39
0
votes
3 answers

Calling JScript functions from VBScript - Parentheses

I'm trying to bring some sanity to a legacy Classic ASP application, and as part of this I'm trying to write a Fluent API for some JScript classes that I have created. e.g. myClass().doSomething().doSomethingElse() The concept is outlined here (in…
Brett Postin
  • 11,215
  • 10
  • 60
  • 95
0
votes
1 answer

Need help on EF Code First Fluent Mapping Many To Many

I am developing an ASP.NET MVC4 application with EF Code First. I am having a many-to-many relationship among following classes. I have defined relationship using EF fluent api in my context class. But I am getting an error as it is trying to insert…
0
votes
1 answer

EF Fluent - How to map required one to optional one with a goofy foreign key? (Invalid Foreign Key Table_TableId)

Why is this so #$*% hard? Shouldn't be. Two tables Orders & Shippers: Orders.ship_via, an int is the FK to Shippers.ShipperId Shippers.ShipperId is the PK on Shippers My entities: public class Order : Entity { public int OrderId { get; set; } …
Rap
  • 6,851
  • 3
  • 50
  • 88
0
votes
1 answer

Dynamic way to Generate EntityTypeConfiguration : The type 'TResult' must be a non-nullable value type

I was thinking to generate EntityTypeConfiguration dynamically from run time and i don't want any EF dependency in Models[That is why i avoid Data Annotation]. So I declare a custom attribute(or can be any configuration file later…
Morshed
  • 1
  • 3