private void SetupSqlServer(ILogger logger)
        {
            //create the db
            _dbSqlServer = new UmbracoDatabase(
                "server=.\\SQLExpress;database=YOURDB;user id=YOURUSER;password=YOURPASS",
                Constants.DatabaseProviders.SqlServer,
                logger);

            //drop the table
            // note: DROP TABLE IF EXISTS is SQL 2016+
            _dbSqlServer.Execute("IF OBJECT_ID('dbo.umbracoServer', 'U') IS NOT NULL DROP TABLE [umbracoServer]");

            //re-create it
            _dbSqlServer.Execute(@"CREATE TABLE [umbracoServer](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[address] [nvarchar](500) NOT NULL,
	[computerName] [nvarchar](255) NOT NULL,
	[registeredDate] [datetime] NOT NULL CONSTRAINT [DF_umbracoServer_registeredDate]  DEFAULT (getdate()),
	[lastNotifiedDate] [datetime] NOT NULL,
	[isActive] [bit] NOT NULL,
	[isMaster] [bit] NOT NULL,
 CONSTRAINT [PK_umbracoServer] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
)");
        }
Example #2
0
        private void SetupSqlCe(string path, ILogger logger)
        {
            var dbName = string.Concat("Umb", Guid.NewGuid(), ".sdf");

            AppDomain.CurrentDomain.SetData("DataDirectory", path);
            var sqlCeConnectionString = $"Datasource=|DataDirectory|\\{dbName};Flush Interval=1;";

            _dbFile = Path.Combine(path, dbName);

            //only create the db one time
            if (_initDbBytes == null)
            {
                using (var engine = new SqlCeEngine(sqlCeConnectionString))
                {
                    engine.CreateDatabase();
                }

                //use the db  to create the initial schema so we can reuse in each bench
                using (_dbSqlCe = GetSqlCeDatabase(sqlCeConnectionString, logger))
                {
                    var creation = new DatabaseSchemaCreator(_dbSqlCe, logger);
                    creation.InitializeDatabaseSchema();
                }
                _initDbBytes = File.ReadAllBytes(_dbFile);
            }
            else
            {
                File.WriteAllBytes(_dbFile, _initDbBytes);
            }

            //create the db
            _dbSqlCe = GetSqlCeDatabase(sqlCeConnectionString, logger);
        }
        public IcelandAuthController(Umbraco.Core.Logging.ILogger logger)
        {
            Log = logger;
            var log = new UmbracoLogger(Log, typeof(IcelandAuthService));
            var icelandAuthService = new IcelandAuthService(log);

            AuthHandler = new ControllerBehavior(icelandAuthService);
        }
Example #4
0
        private IUmbracoDatabase GetSqlCeDatabase(string cstr, ILogger logger)
        {
            var f = new UmbracoDatabaseFactory(
                cstr,
                Constants.DatabaseProviders.SqlCe,
                logger,
                new Lazy <IMapperCollection>(() => new MapperCollection(Enumerable.Empty <BaseMapper>())));

            return(f.CreateDatabase());
        }
Example #5
0
        // FIXME: should run on LocalDb same as NPoco tests!

        private IUmbracoDatabase GetSqlServerDatabase(ILogger logger)
        {
            IScopeProvider f       = null;
            var            l       = new Lazy <IScopeProvider>(() => f);
            var            factory = new UmbracoDatabaseFactory(
                "server=.\\SQLExpress;database=YOURDB;user id=YOURUSER;password=YOURPASS",
                Constants.DatabaseProviders.SqlServer,
                logger,
                new Lazy <IMapperCollection>(() => new MapperCollection(Enumerable.Empty <BaseMapper>())));

            return(factory.CreateDatabase());
        }
Example #6
0
 /// <summary>
 /// Initializes with an XML source
 /// </summary>
 /// <param name="source"></param>
 /// <param name="logger"></param>
 public OldLocalizedTextService(IDictionary <CultureInfo, Lazy <XDocument> > source, ILogger logger)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     if (logger == null)
     {
         throw new ArgumentNullException("logger");
     }
     _xmlSource = source;
     _logger    = logger;
 }
Example #7
0
 /// <summary>
 /// Initializes with a file sources instance
 /// </summary>
 /// <param name="fileSources"></param>
 /// <param name="logger"></param>
 public OldLocalizedTextService(Lazy <LocalizedTextServiceFileSources> fileSources, ILogger logger)
 {
     if (logger == null)
     {
         throw new ArgumentNullException("logger");
     }
     _logger = logger;
     if (fileSources == null)
     {
         throw new ArgumentNullException("fileSources");
     }
     _fileSources = fileSources;
 }
 public MyRenderMvcController(ILogger logger)
 {
     this._logger = logger;
 }
 public UmbracoLogWrapper(UmbracoLogging.ILogger logger)
 {
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Example #10
0
 // Client Dependency doesn't know how to inject
 public CdfLogger(/*ICoreLogger logger*/)
 {
     _logger = Current.Logger;
 }
Example #11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Log4NetLogger"/> class.
 /// </summary>
 /// <param name="loggerRepository">The repository name.</param>
 /// <param name="name">The logger's name.</param>
 public UmbracoLogger(Umbraco.Core.Logging.ILogger logger, Type t)
 {
     log  = logger;
     type = t;
 }
Example #12
0
 /// <summary>
 /// Initializes with a source of a dictionary of culture -> areas -> sub dictionary of keys/values
 /// </summary>
 /// <param name="source"></param>
 /// <param name="logger"></param>
 public OldLocalizedTextService(IDictionary <CultureInfo, IDictionary <string, IDictionary <string, string> > > source, ILogger logger)
 {
     _dictionarySource = source ?? throw new ArgumentNullException(nameof(source));
     _logger           = logger ?? throw new ArgumentNullException(nameof(logger));
 }