Example #1
0
        public static IApplicationDal Get(DalTypes dType, string connectionString)
        {
            if (string.IsNullOrEmpty(connectionString))
            {
                throw new ArgumentException("Invalid connection string", nameof(connectionString));
            }

            if (dType == DalTypes.None)
            {
                throw new ArgumentException("Invalid dal type", nameof(dType));
            }

            IApplicationDal dal = null;

            switch (dType)
            {
            case DalTypes.OrmSqliteNet:
                dal = new SqliteNetAppDal();
                break;

            default:
                throw new NotSupportedException($"Dal type not supported:[{dType}]");
            }

            dal.Init(connectionString);
            return(dal);
        }
Example #2
0
        public void Setup()
        {
            var path = new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName;

            ConnectionString = Path.Combine(path, "ServerTestsDb.db");

            Assert.True(File.Exists(ConnectionString), $"Db file not found at:[{ConnectionString}]");

            Dal = DalFactory.Get(DalTypes.OrmSqliteNet, ConnectionString);
            var open = Dal.OpenDatabase();
        }
 public ApplicationManager(IApplicationDal applicationDal)
 {
     _applicationDal = applicationDal;
 }