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

Mapping Properties of type of Complex Type to DB Columns in EF 6 using code first and custom EntityTypeConfiguration implementation

This is my first activity with great stack overflow, but absolutely not my first time to visit the website. My Question: In our project, we are extending the EntityTypeConfiguration to take control over the mapping of entities to the DB in code…
0
votes
1 answer

How to implement optional branches in fluent interfaces

I'm currently creating a fluent interface and I'm not 100% sure what's the best way to implement optional branches. A little example: // Normal service registration .AddService(myService) // Service registration with additional…
D.R.
  • 20,268
  • 21
  • 102
  • 205
0
votes
1 answer

Fluent API EF 6 - How to configure 1:M (with M being of the same type)

I'm making my first steps with Fluent Api and I'm trying to understand how to do the following: This is my model. public class Person { public int Id {get ; set;} public List Viewers {get; set;} } public class View { public int Id…
MRFerocius
  • 5,509
  • 7
  • 39
  • 47
0
votes
1 answer

Fluent NHibernate "HasMany" classes in Configuration.ClassMappings

I'm trying to create a procedure to check the database structure, and for most of it I just look at "NHibernate.Cfg.Configuration.ClassMappings", but I can't find in the PersistentClass collection or each class properties the list of tables…
0
votes
1 answer

How do I get all the key for the components that are currently register in Castle Windsor?

The main question is in the title but here is the background. Since I pick the lazy way to register my components container.Register( AllTypes.Pick().FromAssembly( typeof (MyModelBinder).Assembly).WithService.FirstInterface() …
firefly
  • 285
  • 3
  • 12
0
votes
1 answer

How to name a map association with fluent api

So far I have built a fluent api association between the database tables. example: //Map Skill Associations modelBuilder.Entity() .HasMany( s => s.Employees ).WithMany( e => e.Skills ) .Map( m => { m.ToTable( "Employee_Skill"…
GoldBishop
  • 2,820
  • 4
  • 47
  • 82
0
votes
0 answers

Map both tables in Many to Many relationship

I am in the process of implementing an entity framework and code-first technique using Fluent API. I already have a mapping for one table: modelBuilder.Entity() .HasMany( c => c.Employees ).WithMany( e => e.Certificates ) …
GoldBishop
  • 2,820
  • 4
  • 47
  • 82
0
votes
1 answer

Use Table-Per-Type for all EF context classes with Fluent API

Currently, if I want to use Fluent API to stipulate the table-per-type inheritance strategy, I have to do the…
tacos_tacos_tacos
  • 10,277
  • 11
  • 73
  • 126
0
votes
1 answer

Entity framework Code First multiple mappings of one entity type inside of another entity type

I am working on an Entity Framework Code First project and having some issues creating mappings. A little background: The database will be used for an online survey demo. For the purposes of this question, it's useful to know that we have Question…
0
votes
1 answer

Entity Framework Fluent API

My Entities are as follows... public class Project{ public int Id { get; set; } public string Name { get; set; } public string Description { get; set; } public virtual ICollection Surveys { get; set; } } public…
0
votes
1 answer

EF code first include foreign key only

I have a simple one to many relationship between my PolicyVIEInfo class TriggerInfo class. I would like to include the PolicyVIEInfo_Id attribute in the TriggerInfo class but when I add the property I get Invalid column name 'PolicyVIEInfo_Id1'. …
0
votes
2 answers

How to return objects or arrays from a chaining interface in PHP OOP?

I am curious in writing a chaining interface in PHP OOP. I modified this sample code from the php.net website, and I want to take it further - how can I return objects or arrays from this kind of interface? // Declare a simple class class…
Run
  • 54,938
  • 169
  • 450
  • 748
0
votes
1 answer

Entity Framework 5.0, Code First, relationships, fluent API and seeding the database

I am using Visual Studio 2010, C# 4.0 and Entity Framework 5.0. My (simplified) models are: public class Case { public int CaseID { get; set; } public int CaseStatusID { get; set; } public DateTime DateOfNotification { get; set; } …
Peter Smith
  • 5,528
  • 8
  • 51
  • 77
0
votes
1 answer

Fluent Wrapper for Nhibernate Fetch ThenFetch

I have a generic repository with a Query Method that returns IQueryable. In my calling code I can then do something like this _repository.Query(x=>x.EntityId == 1).Fetch(x=>x.MyClassChild).ToList() However, I would then be unable to test…
Raif
  • 8,641
  • 13
  • 45
  • 56
0
votes
2 answers

Code first model not auto incrementing key on insert

I think I have an error in my model, but I'm not sure what it is. First the error The INSERT statement conflicted with the FOREIGN KEY constraint "FK_dbo.ProjectDocAccess_dbo.ProjectDoc_ProjectDocAccessID". The conflict occurred in database…
Jed Grant
  • 1,305
  • 1
  • 17
  • 47