Day 2 with LLBLGen Pro
Morning : Investigated problem with Infragistics UltraWinGrid - found that one had to limit MaxBandDepth to 1 or 2. That head ache solved.
Afternoon : did more tutorials - worked ok.
Started on my own stuff
Have small database (MSSQL 2008 ) only two tables Cases and CommunicationsLog
There is a 1 to Many relationship between Cases and CommunicationsLog.
CREATE TABLE [dbo].[Cases](
[CaseNumber] [int] IDENTITY(1,1) NOT NULL,
[CaseIdentifier] nvarchar NOT NULL,
[CreatedBy] nvarchar NOT NULL,
CONSTRAINT [PK_Cases_1] PRIMARY KEY CLUSTERED
CREATE TABLE [dbo].[CommunicationsLog](
[LogNumber] [int] IDENTITY(1,1) NOT NULL,
[LogType] nvarchar NOT NULL,
[CaseNumber] [int] NOT NULL,
[EnteredBy] nvarchar NOT NULL,
[DateLogged] [date] NOT NULL,
[TimeLogged] time NOT NULL,
[LogEntry] nvarchar NOT NULL,
CONSTRAINT [PK_CommunicationsLog] PRIMARY KEY CLUSTERED
The relationship is on the CaseNumber fields (FK_CommunicationsLog_Cases)
If I run
select C.CaseIdentifier, C.CreatedBy,
L.LogType , L.EnteredBy, L.DateLogged, L.TimeLogged
from dbo.Cases as c
left outer join dbo.CommunicationsLog as L
on C.CaseNumber = L.CaseNumber
I get
CaseIdentifier CreatedBy LogType EnteredBy DateLogged TimeLogged
08V00001 he00273 Received Email he00273 2008-09-26 13:39:37
08V00002 he00273 Sent Email he00273 2008-09-26 13:39:52
08V00003 he00273 NULL NULL NULL NULL
08V00004 he00273 NULL NULL NULL NULL
08V00005 he00273 NULL NULL NULL NULL
I have used LLBLGen Pro to create the entities and then generated the C# code.
Created a simple project but I do not get any child rows back from the Case parent.
EntityCollection<CasesEntity> MyCases = new EntityCollection<CasesEntity>();
// fetch them using a DataAccessAdapter instance
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
//adapter.FetchEntityCollection(MyItems, filter);
adapter.FetchEntityCollection(MyCases, null);
}
Console.WriteLine("Number of entities fetched: {0}", MyCases.Count);
// Display for each customer fetched the CustomerId and the CompanyName.
foreach (CasesEntity I in MyCases)
{
Console.WriteLine("{0} {1} {2}", I.CaseIdentifier, I.CreatedBy, I.CaseNumber);
foreach (var L in I.CommunicationsLog)
{
Console.WriteLine(" >>>>>>>> {0} {1} {2}", L.LogNumber, L.LogEntry, L.LogType);
}
}
// -------------------------------------------------------
Console.ReadKey();
I get
Number of entities fetched: 5
08V00001 he00273 1
08V00002 he00273 2
08V00003 he00273 3
08V00004 he00273 4
08V00005 he00273 5
Why can't I see anything from my communicationslog table for the first two case rows?