Questions tagged [fluent]

Fluent interface is an API which allows method chaining to make code more readable.

Fluent interface is API which allows method chaining to make code more readable.

1148 questions
13
votes
1 answer

How do I map to a lookup table using Entity Framework Code First with Fluent API

I'm new to asp.net mvc and entity framework code first apporach, I'm not that keen on databases either. I apologise in advance for wrong terminology or the way I understand things. Now to the question. I have the following models: User Model public…
edgarpetrauskas
  • 401
  • 1
  • 4
  • 14
13
votes
2 answers

Fluent NHibernate join single column from another table

I'm using Fluent NHibernate and have two tables; Customer [ID, Name, LanguageID] Languages [ID, Description] I have a Customer entity with the following properties; ID, Name, LanguageID, Language What I would like to do is to join to the Languages…
Matt
  • 195
  • 2
  • 8
13
votes
1 answer

Generic 'TThis' for fluent classes

I'm constructing a fluent interface where I have a base class that contains the bulk of the fluent logic, and a derived class that add some specialized behavior. The problem I'm facing is the return type of the fluent methods in the base class when…
Paul Alexander
  • 31,970
  • 14
  • 96
  • 151
13
votes
1 answer

Using Distinct in Laravel Fluent

I have this join: Return DB::table('volunteer') ->join('volunteer_volunteer_category', 'volunteer_volunteer_category.volunteer_id', '=', 'volunteer.id') ->select(array('*','volunteer.id AS link_id')) …
Glenn Williams
  • 131
  • 1
  • 1
  • 3
12
votes
2 answers

Fluent NHibernate fetching view without unique identifier

I'm trying to map a view without an identifier, but nhibernate still generates a sql with the id column (giving me a sql error, since the ID column does not exists in the db). Maybe I'm misunderstanding the Id() constructor? constructor…
Wyass
  • 153
  • 2
  • 8
12
votes
4 answers

Fluent log4net configuration

Anyone know if there's a fluent way of configuring log4net (appenders and all the properties for appenders etc...). The xml is driving me crazy. Or if not, does anyone know of a decent .Net logging framework that can easily be fluently configured…
Bealer
  • 864
  • 9
  • 16
12
votes
4 answers

Type inference for fluent API

I have the following extension methods: public static IFoo Foo(this IFluentApi api, Action action); public static IFoo Foo( this IFluentApi api, Func func); public static IBar Bar(this IFoo foo); public static void…
D.R.
  • 20,268
  • 21
  • 102
  • 205
12
votes
1 answer

Fluent Nhibernate HasMany on non primary key

**Table Order** Id (PK) NonUniqueId **Table OrderLine** Id (PK) OrderNonUniqueId Text I have a legacy database where there OrderLine references Order via non primary key. A Order Line may belong to many Orders. How can this be mapped at…
Stig
  • 1,974
  • 2
  • 23
  • 50
11
votes
3 answers

How to build a Fluent Nested Guard API

I am building a simple Guard API to protect against illegal parameters being passed to functions and so on. I have the following code: public static class Guard { public static GuardArgument Ensure(T value, string argumentName) { …
Graham
  • 1,497
  • 2
  • 16
  • 36
11
votes
1 answer

Anyone know of any decent resources on Stored Procedures for Fluent Nhibernate 1.1

A recent release of Fluent Nhibernate (1.1) now supports stored procedures. I was wondering if anyone out there has found any good blog articles on how to do this! I am not asking about using classic hbm mappings instead which these questions…
Aim Kai
  • 2,934
  • 1
  • 22
  • 34
11
votes
3 answers

Laravel Fluent add select()s in separate places?

//Earlier in the code, in each Model: query = ModelName::select('table_name.*') //Later in the code in a function in a Trait class that is always called if ($column == 'group_by') { $thing_query->groupBy($value); …
Damon
  • 10,493
  • 16
  • 86
  • 144
10
votes
2 answers

Fluent NHibernate - How to map a List?

I have a class and inside it, a string and a list of enumerators. public enum SomeEnum { Undefined=0, Enum1, Enum2, Enum3, End } public class SomeObject { public virtual int ID{get; set;} public virtual String Name {get;…
holgac
  • 1,509
  • 1
  • 13
  • 25
10
votes
3 answers

Is it bad practice for a class method to return `this`?

public class Chain { public string ChainString; public Chain() { ChainString = "{}"; } public Chain AddLink() { ChainString += "-{}"; return this; // is this a bad idea? } } In the above…
doliphin
  • 752
  • 6
  • 22
10
votes
2 answers

Multiple Associations from one Object to two Objects of the same Entity Type

I am attempting to use code first and the fluent API to create an object that holds two different entities from the same table. In other words, a transfer object holds a reference to two different tank objects--one is the source and the other the…
Matthew
  • 101
  • 4
10
votes
2 answers

Neo4j Cypher Query Builder

I have been trying to come across a query builder for Neo4j's query language Cypher, ideally using a fluent API. I did not find much, and decided to invest some time on building one myself. The result so far is a fluent API query builder for the…
sebastij
  • 101
  • 1
  • 3
1 2
3
76 77