Works! Many thanks :)
Have update on this. Found workaround solution here: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/586">https://github.com/aspnetboilerplate/as ... issues/586</a>
Done as follows:
public partial class Articles_T : IEntity<int>
and
#region Implementation of IEntity<int>
public bool IsTransient()
{
return false;
}
[NotMapped]
public int Id { get { return Articles_ID; } set { Articles_ID = value; } }
#endregion
When execute
Articles_T art = artAppService.Get(articleId);
Get error:
An exception of type 'System.NotSupportedException' occurred in EntityFramework.SqlServer.dll but was not handled in user code
Additional information: The specified type member 'Id' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.
Generated using Code-First templates. Seems that problem solved.
But currently have another issue:
IRepository<> accepts type inherited from Entity which defines primary column as 'Id' int.
Tables in my DB uses different names: ID, [TableName]Id etc
Is it possible to override this ?
Hi,
I have big database with ~400 tables and ~300 views. Going to start using MVC/EF. Selected ASP.NET Boilerplate as framework. As I can understand best approach for me use 'Database First' model.
Have following code:
public class ArticlesAppService : TWAppServiceBase, IArticlesAppService
{
private readonly IRepository<Articles_T> artRepository;
public ArticlesAppService(IRepository<Articles_T> artRepository)
{
this.artRepository = artRepository;
}
public Articles_T Get(int id)
{
return artRepository.Get(id);
}
}
and when I execute Get method - have an error:
_An exception of type 'System.ApplicationException' occurred in EntityFramework.DynamicFilters.dll but was not handled in user code
Additional information: Filter name MustHaveTenant not found_
Are there any ideas what is wrong ?