This question is locked. New answers and comments are not allowed.
Hi Telerik team! I have a problem with your free ORM. I try to use fluent api to create database from my model.
I have to classes:
And i have Fluent Metadata Source:
But when i try to execute LINQ query:
I get error:
"Execution of 'System.Linq.Enumerable:First(IEnumerable`1)' on the database server side currently not implemented."
Thank you.
I have to classes:
public class Person{ public int Id { get; set; } public string Name { get; set; } public IList<Action> Actions { get; set; }}public class Action{ public int Id { get; set; } public string ActionName { get; set; } public DateTime ActionDate { get; set; } public Person Person { get; set; } public int PersonId { get; set; }}public class MyFluentMetadataSource : FluentMetadataSource { protected override IList<MappingConfiguration> PrepareMapping() { IList<MappingConfiguration> preparedConfigurations = new List<MappingConfiguration>(); var personConfiguration = new MappingConfiguration<Person>(); personConfiguration.MapType(p=>new { Id = p.Id, name = p.Name }).ToTable("Persons"); personConfiguration.HasProperty(p => p.Id).IsIdentity(); var actionConfiguration = new MappingConfiguration<Action>(); actionConfiguration.MapType(p => new { p.Id, name = p.ActionDate, p.ActionDate, p.PersonId, }).ToTable("Actions"); actionConfiguration.HasProperty(p => p.Id).IsIdentity(); actionConfiguration.HasAssociation(p => p.Person).WithOpposite(c => c.Actions).HasConstraint((p, c) => p.PersonId == c.Id); preparedConfigurations.Add(personConfiguration); preparedConfigurations.Add(actionConfiguration); return preparedConfigurations; } }But when i try to execute LINQ query:
var query = from p in dbContext.Persons select new { Id = p.Id, Name = p.Name, Action = p.Actions.OrderBy(a=>a.ActionDate).First() };"Execution of 'System.Linq.Enumerable:First(IEnumerable`1)' on the database server side currently not implemented."
Thank you.