Esempio n. 1
0
        public Configuration CreateConfiguration(IOrmConfiguration ormConfiguration)
        {
            var configuration = new Configuration();

            configuration.Configure(ormConfiguration.ConfigurationFile.FullName);

            return(configuration);
        }
Esempio n. 2
0
        public void Init()
        {
            SqlMapper.AddTypeHandler(new SQLiteGuidTypeHandler());
            string filePath = $"{Environment.CurrentDirectory}/FewBox.sqlite";

            if (!File.Exists(filePath))
            {
                throw new Exception($"The SQLite file '{filePath}' is not exists!");
            }
            var ormConfigurationMock = new Mock <IOrmConfiguration>();

            ormConfigurationMock.Setup(x => x.GetConnectionString()).Returns($"Data Source={filePath};"); //Server=localhost;Database=fewbox;Uid=fewbox;Pwd=fewbox;SslMode=REQUIRED;Charset=utf8;ConnectionTimeout=60;DefaultCommandTimeout=60;
            this.OrmConfiguration = ormConfigurationMock.Object;
            var currentUserMock = new Mock <ICurrentUser <Guid> >();

            currentUserMock.Setup(x => x.GetId()).Returns(Guid.Empty);
            this.CurrentUser = currentUserMock.Object;
        }
 public SQLiteSession(IOrmConfiguration ormConfiguration)
     : base(ormConfiguration)
 {
 }
Esempio n. 4
0
 public MySqlSession(IOrmConfiguration ormConfiguration)
     : base(ormConfiguration)
 {
 }
 protected OrmSession(IOrmConfiguration ormConfiguration)
 {
     this.Connection = this.GetDbConnection(ormConfiguration.GetConnectionString());
     this.UnitOfWork = new UnitOfWork(this.Connection);
 }
 public NhibernateUnitOfWorkOrmConfigurated(ISessionFactory sessionFactory, IOrmConfiguration configuration)
 {
     this.Configuration = configuration;
     this.Session       = sessionFactory.OpenSession();
 }