MasterDetailsG.cs :  » Persistence-Frameworks » FileHelpers-Library » FileHelpers » MasterDetail » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Persistence Frameworks » FileHelpers Library 
FileHelpers Library » FileHelpers » MasterDetail » MasterDetailsG.cs
//#undef GENERICS
#define GENERICS
#if NET_2_0

using System.ComponentModel;
using System.Diagnostics;
//using System.ComponentModel.TypeConverter;

namespace FileHelpers.MasterDetail{
  /// <summary>
  /// <para>This class contains information of a Master record an their Details records.</para>
  /// <para>This class is used for the Read and Write operations of the <see cref="MasterDetailEngine"/>.</para>
  /// </summary>
#if ! GENERICS
#if NET_2_0
    [DebuggerDisplay("Master: {Master.ToString()} - Details: {Details.Length}")]
#endif
    [TypeConverter(typeof(ExpandableObjectConverter))]
  public class MasterDetails
  {

    /// <summary>Create an empty instance.</summary>
    public MasterDetails()
    {
      mDetails = mEmpty.mDetails;
    }

    /// <summary>Create a new instance with the specified values.</summary>
    /// <param name="master">The master record.</param>
    /// <param name="details">The details record.</param>
    public MasterDetails(object master, object[] details)
    {
      mMaster = master;
      mDetails = details;
    }
    
    #if NET_2_0
    [DebuggerBrowsable(DebuggerBrowsableState.Never)] 
    #endif
    private static MasterDetails mEmpty = new MasterDetails(null, new object[] {});

    /// <summary>Returns a canonical empty MasterDetail object.</summary>
    public static MasterDetails Empty
    {
      get { return mEmpty; }
    }

    #if NET_2_0
    [DebuggerBrowsable(DebuggerBrowsableState.Never)] 
    #endif
    internal object mMaster;

    /// <summary>The Master record.</summary>
    public object Master
    {
      get { return mMaster; }
      set { mMaster = value; }
    }

    #if NET_2_0
    [DebuggerBrowsable(DebuggerBrowsableState.Never)] 
    #endif
    internal object[] mDetails;

    /// <summary>An Array with the Detail records.</summary>
    [TypeConverter(typeof(ArrayConverter))]
    public object[] Details
    {
      get { return mDetails; }
      set { mDetails = value; }
    }

#else
  public class MasterDetails<M,D>
        where M : class
        where D : class
  {

    /// <summary>Create an empty instance.</summary>
    public MasterDetails()
    {
      mDetails = mEmpty.mDetails;
    }

    /// <summary>Create a new instance with the specified values.</summary>
    /// <param name="master">The master record.</param>
    /// <param name="details">The details record.</param>
    public MasterDetails(M master, D[] details)
    {
      mMaster = master;
      mDetails = details;
    }

    private static MasterDetails<M,D> mEmpty = new MasterDetails<M,D>(null, new D[] {});

    /// <summary>Returns a canonical empty MasterDetail object.</summary>
    public static MasterDetails<M,D> Empty
    {
      get { return mEmpty; }
    }

    internal M mMaster;

    /// <summary>The Master record.</summary>
    public M Master
    {
      get { return mMaster; }
      set { mMaster = value; }
    }

    internal D[] mDetails;

    /// <summary>An Array with the Detail records.</summary>
    public D[] Details
    {
      get { return mDetails; }
      set { mDetails = value; }
    }

#endif

  }
}

#endif
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.