Пример #1
0
        public virtual void ReInitElasticMap()
        {
            using (var context = new ElasticContext(ElasticConnectionString, Config))
            {
                if (!EnvironmentHelper.IsProduction())
                {
                    context.TraceProvider = new ConsoleTraceProvider();
                }

                if (IsExistElasticMap())
                {
                    context.DeleteIndex<TElastic>();
                }
                context.IndexCreate<TElastic>();
            }
        }
Пример #2
0
        public void DeleteElasticMap()
        {
            using (var context = new ElasticContext(ElasticConnectionString, Config))
            {
                if (!EnvironmentHelper.IsProduction())
                {
                    context.TraceProvider = new ConsoleTraceProvider();
                }

                context.AllowDeleteForIndex = true;

                if (!IsExistElasticMap())
                {
                    return;
                }

                context.DeleteIndex<TElastic>();
                IsExistElasticIndex = false;
            }
        }