Ejemplo n.º 1
0
        private static void ChoseDataContext()
        {
            IList <ComposablePartDefinition> contexts = new List <ComposablePartDefinition>();
            IList <ExportDefinition>         copParts = new List <ExportDefinition>();

            foreach (var part in JarsCore.Container.Catalog.Parts)
            {
                foreach (var exDef in part.ExportDefinitions)
                {
                    if (exDef.ContractName.Contains("DataContext"))
                    {
                        contexts.Add(part);
                        copParts.Add(exDef);
                    }
                }
            }
            StringBuilder sbm = new StringBuilder();

            sbm.AppendLine(" Please select a DB Context. ");
            sbm.AppendLine("                             ");
            for (int i = 0; i < copParts.Count(); i++)
            {
                sbm.AppendLine($"({i}) - {copParts[i].ContractName} -");
            }
            sbm.AppendLine(" ");
            sbm.AppendLine("Type the number and press 'Enter':");

            Console.Write(sbm.ToString());
            int cidx = int.Parse(Console.ReadLine());

            context = (IDataContextBaseNh)(contexts[cidx].CreatePart().GetExportedValue(copParts[cidx]));

            Console.Clear();
        }
Ejemplo n.º 2
0
 public DataRepositoryNhReadOnlyBase(IDataContextBaseNh context) : base(context)
 {
 }
Ejemplo n.º 3
0
 public DataRepositoryNhCrudBase(IDataContextBaseNh context) : base(context)
 {
 }
Ejemplo n.º 4
0
 public NH_Repositories_Queries_Tests(IDataRepositoryFactory repFactory, IDataContextBaseNh externalContext, IDataContextBaseNh jarsContext, IDataContextBaseNh qlContext)
 {
     _repFactory     = repFactory;
     ExternalContext = externalContext;
     JarsContext     = jarsContext;
 }
Ejemplo n.º 5
0
 public DataRepositoryNhBase(IDataContextBaseNh context) : base()
 {
     _DBContext = context;
 }
Ejemplo n.º 6
0
        ////or just import but by the actual type
        //[Import]
        //IDataContextNhJars jarsActualContext;

        ////try import many
        //[ImportMany]
        //IEnumerable<IDataContextBaseNh> nhBaseList; //<-results in 0

        public NH_DataContext_Tests(IDataContextBaseNh externalContext, IDataContextBaseNh jarsContext, IDataContextBaseNh qlContext)
        {
            ExternalContext = externalContext;
            JarsContext     = jarsContext;
        }