I'm working with a custom entity User which a have a Logs collection.
If I bind an instance of User to the report I see Logs a property but I don't know how bind the entries of the Logs collection to the report.
Thank you in advance for your help.
Here follow you will find my class that create the custom entities.
Code: Select all
namespace Demo
{
public class User
{
public User()
{
logs = new Collection();
}
private int id;
public int Id
{
get { return id; }
set { id = value; }
}
public string Name
{
get { return string.Format("User {0}", Id); }
}
private Group group;
public Group Group
{
get { return group; }
set { group = value; }
}
private Collection logs;
public Collection Logs
{
get { return logs; }
set { logs = value; }
}
}
public class Group
{
private int id;
public int Id
{
get { return id; }
set { id = value; }
}
private string name;
public string Name
{
get { return name; }
set { name = value; }
}
}
public class Log
{
private DateTime date;
public DateTime Date
{
get { return date; }
set { date = value; }
}
private string action;
public string Action
{
get { return action; }
set { action = value; }
}
}
public sealed class DatabaseFacade
{
public static User GetUser()
{
Group group = new Group();
group.Name = "Admin";
User user = new User();
user.Id = DateTime.Now.Millisecond;
user.Group = group;
for (int i = 0; i < 100; i++)
{
user.Logs.Add(CreateLogEntry());
}
return user;
}
private static Log CreateLogEntry()
{
Log l = new Log();
l.Date = DateTime.Now;
l.Action = "Access denied";
return l;
}
}
}