entity framework - EF Codefirst and RDLC Reports -


I am working on an MVC 4 web app with EF 6. Database). So I have model squares that I use in EF.

Now I need to create some RDLC reports. To do this I need to create a dataset, how can I create a dataset using my model sections?

My ultimate goal is to design and generate data in my reports with the help of my F. model.

Thanks in Adans

Usually EF does not support dataset if If you want to populate datasets with data loaded with EF, then you have to provide your functionality for this. Here I present an example of how the data obtained from query can be used to replicate datatable objects:

  public static class IEnumerableExtensions { Public static dataTable ToDataTable & lt; TEntity & gt; (This IEnumerable & lt; TEntity & gt; Units) {DataTable table = New DataTable (); IEnumerable & LT; PropertyInfo & gt; Properties = Typef (TNTTI) .GetProperties () Where (P => P.PropertyType.IsClass || p.PropertyType == Typef (string)) foreach (in string properties property properties. (P => P. name)) {table.Columns.Add (PropertyName); } Foreach (Object items in items) {List & lt; Object & gt; PropertiesValues ​​= new list & lt; Object & gt; (); Foreach Property (Property Properties in properties) {propertiesValues.Add (property.GetValue (item)); } Table. Rouse Add (multiplication taraare ()); } Return table; }}  

You can then use this extension method as follows:

  DataTable table = context.People.ToDataTable ();  

If you want to apply relationships between tables, then what you have to argue will be more complex. You should use the data relay property of the datatale object to bind to the relationship. Then insert your datatable objects into the dataset.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -