public void Initialize(IFileContextScopedOptions options, IEntityType entityType, object keyValueFactory) { _keyValueFactory = keyValueFactory; _entityType = entityType; _propertyKeys = entityType.GetProperties().Select(p => p.GetColumnName()).ToArray(); _typeList = entityType.GetProperties().Select(p => p.GetValueConverter()?.ProviderClrType ?? p.ClrType).ToArray(); }
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public FileContextTableFactory([NotNull] ILoggingOptions loggingOptions, [NotNull] IFileContextScopedOptions options) { _options = options; Check.NotNull(loggingOptions, nameof(loggingOptions)); _sensitiveLoggingEnabled = loggingOptions.IsSensitiveDataLoggingEnabled; }
public void Initialize(IFileContextScopedOptions options, IEntityType entityType, string fileType) { _type = entityType; _filetype = fileType; _databasename = options.DatabaseName ?? ""; _location = options.Location; }
public void Initialize(IFileContextScopedOptions options, IEntityType entityType, object keyValueFactory) { _keyValueFactory = keyValueFactory; _entityType = entityType; _serializer = (ISerializer)Activator.CreateInstance(typeof(TSerializer)); _serializer.Initialize(options, _entityType, _keyValueFactory); _fileManager = (IFileManager)Activator.CreateInstance(typeof(TFileManager)); _fileManager.Initialize(options, entityType, _serializer.FileType); }
public void Initialize(IFileContextScopedOptions options, IEntityType entityType, object keyValueFactory) { _keyValueFactory = keyValueFactory; _entityType = entityType; _serializer = (ISerializer)_serviceProvider.GetService(options.SerializerType); _serializer.Initialize(options, _entityType, _keyValueFactory); _fileManager = (IFileManager)_serviceProvider.GetService(options.FileManagerType); _fileManager.Initialize(options, entityType, _serializer.FileType); }
public FileContextTable( // WARNING: The in-memory provider is using EF internal code here. This should not be copied by other providers. See #15096 [NotNull] Microsoft.EntityFrameworkCore.ChangeTracking.Internal.IPrincipalKeyValueFactory <TKey> keyValueFactory, bool sensitiveLoggingEnabled, IEntityType entityType, IFileContextScopedOptions options) { _keyValueFactory = keyValueFactory; _sensitiveLoggingEnabled = sensitiveLoggingEnabled; _entityType = entityType; _options = options; _rows = Init(); }
private static Func <IFileContextTable> CreateFactory <TKey>(IKey key, IEntityType entityType, bool sensitiveLoggingEnabled, IFileContextScopedOptions options) => () => new FileContextTable <TKey>( // WARNING: The in-memory provider is using EF internal code here. This should not be copied by other providers. See #15096 Microsoft.EntityFrameworkCore.Metadata.Internal.KeyExtensions.GetPrincipalKeyValueFactory <TKey>(key), sensitiveLoggingEnabled, entityType, options);
public virtual IFileContextStore GetStore(IFileContextScopedOptions options) { return(_namedStores.GetOrAdd(options, _ => new FileContextStore(new FileContextTableFactory(_loggingOptions, options), _useNameMatching))); }
public void Initialize(IFileContextScopedOptions options, IEntityType entityType, object keyValueFactory) { _options = options; _entityType = entityType; _propertyKeys = entityType.GetProperties().Select(p => p.GetColumnName()).ToArray(); _propertyColumnIndices = new int[_propertyKeys.Length]; _typeList = entityType.GetProperties().Select(p => p.GetValueConverter()?.ProviderClrType ?? p.ClrType) .ToArray(); _keyValueFactory = keyValueFactory; if (!_packages.ContainsKey(options.DatabaseName)) { if (!String.IsNullOrEmpty(options.Password)) { _package = new ExcelPackage(GetFilePath(), options.Password); _packages.Add(options.DatabaseName, _package); } else { _package = new ExcelPackage(GetFilePath()); _packages.Add(options.DatabaseName, _package); } } else { _package = _packages[options.DatabaseName]; } string name = entityType.GetTableName(); _worksheet = _package.Workbook.Worksheets[name]; if (_worksheet == null) { _worksheet = _package.Workbook.Worksheets.Add(name); _worksheet.Column(1).AutoFit(); for (int i = 0; i < _propertyKeys.Length; i++) { _worksheet.Cells[1, i + 1].Value = _propertyKeys[i]; _propertyColumnIndices[i] = i + 1; _worksheet.Column(i + 1).AutoFit(); } _worksheet.View.FreezePanes(2, 1); if (!String.IsNullOrEmpty(options.Password)) { _package.Save(options.Password); } else { _package.Save(); } } else { for (int i = 0; i < _propertyKeys.Length; i++) { for (int x = 0; x < _worksheet.Dimension.Columns; x++) { string val = _worksheet.Cells[1, x + 1].GetValue <string>(); if (_propertyKeys[i].Equals(val, StringComparison.InvariantCultureIgnoreCase)) { _propertyColumnIndices[i] = x + 1; break; } } } } }