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
0
votes
1 answer

Adding DateTime field to many-to-many EF Code First relationship

I am using EF 6 Code-First, table per type, and I have two concrete classes Group and User. Group has a navigation property Members which contains a collection of User. I have mapped this many-to-many relationship in EF using Fluent…
tacos_tacos_tacos
  • 10,277
  • 11
  • 73
  • 126
0
votes
1 answer

Set composite key on table with only One-to–Zero-or-One relations

Using EF6 I'm trying to define the following relation A(1)---(0..1)C(0..1)---(1)B (The (x) is the cardinality). Table C would then use a composite key of the 2 foreign keys from A and B. // Other properties are omitted for brevity public class A { …
Snæbjørn
  • 10,322
  • 14
  • 65
  • 124
0
votes
1 answer

Many to Many relationship EF with foreign keys

I want to configure many to many relationship between 2 entities but I would also like to expose their foreign keys. I found only one concrete solution online like following: modelBuilder.Entity() .HasMany(t =>…
lbrahim
  • 3,710
  • 12
  • 57
  • 95
0
votes
2 answers

Recursion in Fluent API

I am designing a fluent API for writing SQL. Keep in mind one of my goals is to have API not suggest functions that can't be called in that part of the chain. For instance if you just got done defining a field in the select clause you can't call…
Greg Cobb
  • 466
  • 6
  • 15
0
votes
0 answers

One to Zero-or-One relation via fluent API

I want to define the following model with fluent api. So I wrote this model public class Entity1 { public int Id { get; set; } public virtual Entity2 Entity2 { get; set; } } public class Entity2 { public int Id { get; set; } public virtual…
Snæbjørn
  • 10,322
  • 14
  • 65
  • 124
0
votes
0 answers

A circular reference was detected while serializing an object of type. In 1 to Many relationship

I have to 2 simple classes as following: PermissionGroup: public class PermissionGroup { public int PermissionGroupId { get; set; } public string PermissionGroupName { get; set; } public virtual ICollection
0
votes
3 answers

JavaScript fluent interfaces like in Angular.js

I'm playing with Angular.js and especially with $http and the following code: $http.get('test.url').onsuccess(function(res){}); I was wondering how can I program a structure like that. First try was to determine this within the Angular.js code,…
0
votes
1 answer

Method chaining and the finishing problem

are there any approaches, given a statement like the following First().Second(); to know from within First() whether/when Second() has executed? Reference: http://martinfowler.com/dslwip/MethodChaining.html
Simone
  • 3,607
  • 1
  • 31
  • 37
0
votes
1 answer

Navigation Property Mapping on two different fields

I have a squirrely situation, where in some relationships a tables ID field is used as the key reference. But in other, older implementations, the Name field was used as the relationship mapping. FileType: ID | Name |.... FileTypeDetails: ID |…
GoldBishop
  • 2,820
  • 4
  • 47
  • 82
0
votes
2 answers

Write a linq query with many to many scenario and other table

I want to write a linq query that join some tables and return a custom object but I have some problems with the many to many table because I do not have any object to work with. You will see at the end my problematic linq query but for now let's me…
Karine
  • 385
  • 1
  • 7
  • 18
0
votes
0 answers

How to implement custom query for Navigation Property in EF

Is there a way to implement a custom query design for a Navigation property, preferably using Fluent API? I have seen several implementations using the Query Projections design pattern, but failed to find any that implement it at the property level.…
GoldBishop
  • 2,820
  • 4
  • 47
  • 82
0
votes
1 answer

remove the default Cache setting in Fluent NHibernate

I'm glad to set common cache for almost all the entity like the following with Fluent NHibernate: public static FluentConfiguration Create(string connStr) { return Fluently.Configure() .Cache(x =>…
freeflying
  • 215
  • 3
  • 12
0
votes
2 answers

Laravel Fluent/Eloquent - check for related rows

I currently have a simple situation which I'm trying to find a good solution for - in my app, one Post has zero-to-many comments. I'm trying to work out how to query with either Fluent or Eloquent to find only the posts which have comments…
Joe
  • 15,669
  • 4
  • 48
  • 83
0
votes
1 answer

How to set default-cascade in Fluent NHibernate

I find we can specify the "default-cascade" attribute of the element. But how can I do it in Fluent NHibernate? And I don't want to use AutoMapping.
freeflying
  • 215
  • 3
  • 12
0
votes
1 answer

Implementation of greateast N per group with Laravel's query builder

The problem is to implement the nested query on the second INNER JOIN : SELECT a, b, c FROM t1 INNER JOIN t2 ON t2.b = t1.b INNER JOIN ( SELECT a, max(c) AS d FROM t3 GROUP BY a ) AS t3 ON ( t3.a = t1.a AND t3.d = t1.c ) I've try a lot of test…
Fractaliste
  • 5,777
  • 11
  • 42
  • 86