Skip to content

Commit 83a73ec

Browse files
committed
Forgot to remove obsolete code
1 parent 640d71a commit 83a73ec

7 files changed

Lines changed: 2 additions & 199 deletions

File tree

src/Libraries/SmartStore.Core/Infrastructure/DependencyManagement/AutofacLifetimeScopeProvider.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ public void EndLifetimeScope()
4242

4343
public ILifetimeScope GetLifetimeScope(Action<ContainerBuilder> configurationAction)
4444
{
45-
//return LifetimeScope ?? (LifetimeScope = GetLifetimeScopeCore(configurationAction));
46-
4745
//little hack here to get dependencies when HttpContext is not available
4846
if (HttpContext.Current != null)
4947
{

src/Libraries/SmartStore.Core/Infrastructure/DependencyManagement/AutofacRequestLifetimeHttpModule.cs

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -51,60 +51,5 @@ public void Dispose()
5151
}
5252

5353
#endregion
54-
55-
#region OBSOLETE
56-
57-
//private static readonly ThreadLocal<ILifetimeScope> _lifetimeScope = new ThreadLocal<ILifetimeScope>(false);
58-
59-
///// <summary>
60-
///// Gets a nested lifetime scope that services can be resolved from.
61-
///// </summary>
62-
///// <param name="container">The parent container.</param>
63-
///// <param name="configurationAction">Action on a <see cref="ContainerBuilder"/>
64-
///// that adds component registations visible only in nested lifetime scopes.</param>
65-
///// <returns>A new or existing nested lifetime scope.</returns>
66-
//public static ILifetimeScope GetLifetimeScope(ILifetimeScope container, Action<ContainerBuilder> configurationAction)
67-
//{
68-
// return LifetimeScope ?? (LifetimeScope = InitializeLifetimeScope(configurationAction, container));
69-
70-
// ////little hack here to get dependencies when HttpContext is not available
71-
// //if (HttpContext.Current != null)
72-
// //{
73-
// // return LifetimeScope ?? (LifetimeScope = InitializeLifetimeScope(configurationAction, container));
74-
// //}
75-
// //else
76-
// //{
77-
// // //throw new InvalidOperationException("HttpContextNotAvailable");
78-
// // return InitializeLifetimeScope(configurationAction, container);
79-
// //}
80-
//}
81-
82-
//static ILifetimeScope LifetimeScope
83-
//{
84-
// get
85-
// {
86-
// if (HttpContext.Current != null)
87-
// {
88-
// return (ILifetimeScope)HttpContext.Current.Items[typeof(ILifetimeScope)];
89-
// }
90-
// else
91-
// {
92-
// return _lifetimeScope.Value;
93-
// }
94-
// }
95-
// set
96-
// {
97-
// if (HttpContext.Current != null)
98-
// {
99-
// HttpContext.Current.Items[typeof(ILifetimeScope)] = value;
100-
// }
101-
// else
102-
// {
103-
// _lifetimeScope.Value = value;
104-
// }
105-
// }
106-
//}
107-
108-
#endregion
10954
}
11055
}

src/Libraries/SmartStore.Core/Infrastructure/DependencyManagement/ContainerConfigurer.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,9 @@ public virtual void Configure(IEngine engine, ContainerManager containerManager,
3939
// event broker
4040
containerManager.AddComponentInstance(broker);
4141

42-
//// AutofacDependencyResolver
42+
// AutofacDependencyResolver
4343
var scopeProvider = new AutofacLifetimeScopeProvider(containerManager.Container);
4444
var dependencyResolver = new AutofacDependencyResolver(containerManager.Container, scopeProvider);
45-
//containerManager.AddComponentInstance<AutofacDependencyResolver>(dependencyResolver);
4645
DependencyResolver.SetResolver(dependencyResolver);
4746
}
4847
}

src/Libraries/SmartStore.Core/Infrastructure/DependencyManagement/ContainerManager.cs

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ namespace SmartStore.Core.Infrastructure.DependencyManagement
1212
public class ContainerManager
1313
{
1414
private readonly IContainer _container;
15-
private ILifetimeScope _threadScope;
1615

1716
public ContainerManager(IContainer container)
1817
{
@@ -195,35 +194,14 @@ public ILifetimeScope Scope()
195194
{
196195
try
197196
{
198-
return _threadScope ?? AutofacDependencyResolver.Current.RequestLifetimeScope ?? Container;
197+
return AutofacDependencyResolver.Current.RequestLifetimeScope ?? Container;
199198
}
200199
catch
201200
{
202201
return Container;
203202
}
204203
}
205204

206-
public IDisposable CreateThreadScope()
207-
{
208-
return ActionDisposable.Empty;
209-
210-
//if (HttpContext.Current != null)
211-
// return ActionDisposable.Empty;
212-
213-
//if (_threadScope == null)
214-
//{
215-
// _threadScope = _container.BeginLifetimeScope(AutofacLifetimeScopeProvider.HttpRequestTag);
216-
//}
217-
218-
//return new ActionDisposable(() =>
219-
//{
220-
// if (_threadScope != null)
221-
// {
222-
// _threadScope.Dispose();
223-
// _threadScope = null;
224-
// }
225-
//});
226-
}
227205
}
228206

229207
public static class ContainerManagerExtensions

src/Libraries/SmartStore.Services/ExportImport/IImportManager.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ namespace SmartStore.Services.ExportImport
1111
/// </summary>
1212
public interface IImportManager
1313
{
14-
/// <summary>
15-
/// Import products from XLSX file
16-
/// </summary>
17-
/// <param name="stream">Stream</param>
18-
ImportResult ImportProductsFromXlsx(Stream stream);
19-
2014
Task<ImportResult> ImportProductsFromExcelAsync(
2115
Stream stream,
2216
CancellationToken cancellationToken,

src/Libraries/SmartStore.Services/ExportImport/ImportManager.cs

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -187,109 +187,6 @@ public virtual async Task<ImportResult> ImportProductsFromExcelAsync(
187187
return t;
188188
}
189189

190-
/// <summary>
191-
/// Import products from XLSX file
192-
/// </summary>
193-
/// <param name="stream">Stream</param>
194-
public virtual ImportResult ImportProductsFromXlsx(Stream stream)
195-
{
196-
Guard.ArgumentNotNull(() => stream);
197-
198-
var result = new ImportResult();
199-
200-
using (var scope = new DbContextScope(autoDetectChanges: false, proxyCreation: false, validateOnSave: false))
201-
{
202-
using (var segmenter = new DataSegmenter<Product>(stream))
203-
{
204-
result.TotalRecords = segmenter.TotalRows;
205-
206-
while (segmenter.ReadNextBatch())
207-
{
208-
var batch = segmenter.CurrentBatch;
209-
210-
// ===========================================================================
211-
// 1.) Import products
212-
// ===========================================================================
213-
try
214-
{
215-
ProcessProducts(batch, result);
216-
}
217-
catch (Exception ex)
218-
{
219-
result.AddError(ex);
220-
}
221-
222-
// reduce batch to saved (valid) products.
223-
// No need to perform import operations on errored products.
224-
batch = batch.Where(x => x.Entity != null && !x.IsTransient).AsReadOnly();
225-
226-
// update result object
227-
result.NewRecords += batch.Count(x => x.IsNew && !x.IsTransient);
228-
result.ModifiedRecords += batch.Count(x => !x.IsNew && !x.IsTransient);
229-
230-
// ===========================================================================
231-
// 2.) Import SEO Slugs
232-
// IMPORTANT: Unlike with Products AutoCommitEnabled must be TRUE,
233-
// as Slugs are going to be validated against existing ones in DB.
234-
// ===========================================================================
235-
if (batch.Any(x => x.IsNew || (x.ContainsKey("SeName") || x.NameChanged)))
236-
{
237-
ProcessSlugs(batch, result);
238-
}
239-
240-
// ===========================================================================
241-
// 3.) Import product category mappings
242-
// ===========================================================================
243-
if (batch.Any(x => x.ContainsKey("CategoryIds")))
244-
{
245-
try
246-
{
247-
ProcessProductCategories(batch, result);
248-
}
249-
catch (Exception ex)
250-
{
251-
result.AddError(ex);
252-
}
253-
}
254-
255-
// ===========================================================================
256-
// 4.) Import product manufacturer mappings
257-
// ===========================================================================
258-
if (batch.Any(x => x.ContainsKey("ManufacturerIds")))
259-
{
260-
try
261-
{
262-
ProcessProductManufacturers(batch, result);
263-
}
264-
catch (Exception ex)
265-
{
266-
result.AddError(ex);
267-
}
268-
}
269-
270-
// ===========================================================================
271-
// 5.) Import product picture mappings
272-
// ===========================================================================
273-
if (batch.Any(x => x.ContainsKey("Picture1") || x.ContainsKey("Picture2") || x.ContainsKey("Picture3")))
274-
{
275-
try
276-
{
277-
ProcessProductPictures(batch, result);
278-
}
279-
catch (Exception ex)
280-
{
281-
result.AddError(ex);
282-
}
283-
}
284-
285-
}
286-
}
287-
}
288-
289-
result.EndDateUtc = DateTime.UtcNow;
290-
return result;
291-
}
292-
293190
private async Task<int> ProcessProducts(ICollection<ImportRow<Product>> batch, ImportResult result)
294191
{
295192
_rsProduct.AutoCommitEnabled = false;

src/Presentation/SmartStore.Web/Global.asax.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,6 @@ protected void Application_Start()
9191

9292
bool databaseInstalled = DataSettingsHelper.DatabaseIsInstalled();
9393

94-
//// set dependency resolver
95-
//var container = EngineContext.Current.ContainerManager.Container;
96-
//var scopeProvider = new SmartLifetimeScopeProvider(container);
97-
//var dependencyResolver = new AutofacDependencyResolver(container, scopeProvider);
98-
//DependencyResolver.SetResolver(dependencyResolver);
99-
////var dependencyResolver = new SmartDependencyResolver();
100-
////DependencyResolver.SetResolver(dependencyResolver);
101-
10294
// model binders
10395
ModelBinders.Binders.DefaultBinder = new SmartModelBinder();
10496

0 commit comments

Comments
 (0)