public string Convert(int source, ResolutionContext context)
 {
     using (PSMContext ctx = new PSMContext())
     {
         return(ctx.finance_period.Find(source).period_name);
     }
 }
        static void Main(string[] args)
        {
            string sourceFile = null;
            string output = null;
            try
            {
                if (args.Length == 0)
                {
                    Usage("No arguments specified!");
                    return;
                }
                for (var i = 0; i < args.Length; i++)
                {
                    var arg = args[i];
                    switch (arg.ToLower())
                    {
                        case "-sourcefile":
                            sourceFile = args[++i];
                            if(!File.Exists(sourceFile)) Usage("source PSM file does not exist or is an invalid path.");
                            break;
                        case "-output":
                            output = args[++i];
                            break;
                        default :
                            Usage("Incorrect option specified.");
                            return;
                    }
                }
            }
            catch (Exception ex)
            {
                Usage(ex.Message);
            }
            
            Devart.Data.SQLite.Entity.Configuration.SQLiteEntityProviderConfig.Instance.Workarounds.IgnoreSchemaName = true;
            DbConnection connection = new Devart.Data.SQLite.SQLiteConnection(string.Format("Data Source='{0}';FailIfMissing=False", output));
            var psm = new PSMContext(connection, false, new DropCreateDatabaseAlways<PSMContext>());

            Console.WriteLine("populating database...");
            ESME.Database.Importers.PSMFile.Import(sourceFile, psm);
            Console.WriteLine("done.");
        }
Beispiel #3
0
        //CDISContext cdisDbContext;

        //public CDISContext CDISInit()
        //{
        //    return cdisDbContext ?? (cdisDbContext = new CDISContext());
        //}

        public PSMContext Init()
        {
            return(psmDbContext ?? (psmDbContext = new PSMContext()));
        }