public ProductRepository(AdventureWorks2016Context context) { this.context = context; this.mapperConfig = new MapperConfiguration(cfg => { cfg.CreateMap <AdventureWorks.Data.Entities.Product, ProductModel>(MemberList.Destination) .ForMember(p => p.Photos, m => m.MapFrom(prod => prod.ProductProductPhoto.Select(photo => Convert.ToBase64String(photo.ProductPhoto.LargePhoto)))); }); }
public IQueryable <Product> GetProducts([ScopedService] AdventureWorks2016Context context) { //dapper方式 //using (var con = new SqlConnection("Data Source=.;Initial Catalog=AdventureWorks2016;Persist Security Info=True;User ID=sa;Password=sa")) //{ // return con.Query<Product>("select * from production.product"); //} //ef方式 return(context.Products); }
public static async Task Run( [QueueTrigger("filemetadataproductionistest", Connection = "QueueStorage")] CloudQueueMessage myQueueItem, Binder binder, ILogger log) { //log.LogInformation($"C# Queue trigger function processed: {myQueueItem}"); var dto = JsonConvert.DeserializeObject <DocumentDto>(myQueueItem.AsString); var blobName = dto.AzureFileName; //todo get blob from storage (by guid from the queue) var attributes = new Attribute[] { new BlobAttribute("docstoragecontaineristest/" + blobName), new StorageAccountAttribute("AzureWebJobsStorage") }; CloudBlockBlob blob = await binder.BindAsync <CloudBlockBlob>(attributes); dto.DocumentContent = new byte[dto.DocumentContentLenght]; var result = blob.DownloadToByteArrayAsync(dto.DocumentContent, 0).Result; //dto.DocumentContent = ReadBlob("docstoragecontaineristest", blobName, dto.DocumentContentLenght); var connectionString = Environment.GetEnvironmentVariable("AdventureWorksDatabase"); var optionsBuilder = new DbContextOptionsBuilder <AdventureWorks2016Context>(); optionsBuilder.UseSqlServer(connectionString); using (var context = new AdventureWorks2016Context(optionsBuilder.Options)) { // add doc to the db //var owner = context.Employee.Where(x => x.BusinessEntityId == 1).FirstOrDefault(); var docId = context.GetNextDocId(); context.Document.Add(new Document() { ChangeNumber = 1, DocumentContent = dto.DocumentContent, DocumentNode = docId, DocumentSummary = dto.DocumentMetadata, FileExtension = Path.GetExtension(dto.FileName), FileName = dto.FileName, FolderFlag = false, ModifiedDate = DateTime.Now, Owner = 1, Revision = "", Rowguid = Guid.NewGuid(), Status = 1, Title = dto.DocumentName }); context.SaveChanges(); } }
public BaseRepository(AdventureWorks2016Context context) { this.context = context; this.configuration = new MapperConfiguration(cfg => { var modelToEntity = cfg.CreateMap <TModel, TEntity>(MemberList.Source); this.ConfigModelToEntityMapping(modelToEntity); var entityToModel = cfg.CreateMap <TEntity, TModel>(MemberList.Destination); this.ConfigEntityToModelMapping(entityToModel); }); this.mapper = configuration.CreateMapper(); }
public CategoriesViewComponent(AdventureWorks2016Context db) => _db = db;
public PersonRepository(AdventureWorks2016Context repositoryContext) : base(repositoryContext) { }
public CartController(AdventureWorks2016Context db, IMediator mediator) { _db = db; _mediator = mediator; }
public CartController(AdventureWorks2016Context db, IDocumentDBRepository <OrderRequest> docDbRepository, IMediator mediator) { _db = db; _docDbRepository = docDbRepository; _mediator = mediator; }
public JobCandidateRepository(AdventureWorks2016Context context) : base(context) { }
public ListModel(AdventureWorks2016Context db) => _db = db;
public BusinessEntityContactController(AdventureWorks2016Context AdventureWorks2016Context) { _db = AdventureWorks2016Context; }
public ShiftRepository(AdventureWorks2016Context context) : base(context) { }
public ProductsController(AdventureWorks2016Context context, ILogger <ProductsController> logger) { _logger = logger; _context = context; _logger.LogDebug(1, "NLog injected into Controller"); }
public ProductCacheJob(IElasticSearchService elasticSearchService, AdventureWorks2016Context context) { this._elasticSearchService = elasticSearchService; this._context = context; }
public OrderRepository(AdventureWorks2016Context context) { this.context = context; this.mapperConfig = this.CreateMapperConfig(); }
public RepositoryWrapper(AdventureWorks2016Context repositoryContext) { _adventureWorks2016ContextContext = repositoryContext; }
public AddressTypeController(AdventureWorks2016Context AdventureWorks2016Context) { _db = AdventureWorks2016Context; }
public IQueryable <Product> GetProducts([ScopedService] AdventureWorks2016Context context) { return(context.Products); }
public IndexModel(AdventureWorks2016Context db) => _db = db;
public DepartmentRepository(AdventureWorks2016Context context) : base(context) { }
public ContactTypeController(AdventureWorks2016Context AdventureWorks2016Context) { _db = AdventureWorks2016Context; }
public EmployeeRepository(AdventureWorks2016Context context) : base(context) { }
public ShowModel(AdventureWorks2016Context db) => _db = db;
public PersonPhoneController(AdventureWorks2016Context AdventureWorks2016Context) { _db = AdventureWorks2016Context; }
public PersonController(AdventureWorks2016Context adventureWorks2016Context) { db = adventureWorks2016Context; }
public IQueryable <Person> GetPersons([ScopedService] AdventureWorks2016Context context) { return(context.People); }
public ProductController(AdventureWorks2016Context context) { _context = context; }
public EmailAddressController(AdventureWorks2016Context AdventureWorks2016Context) { _db = AdventureWorks2016Context; }
public GenericRepository(AdventureWorks2016Context _db) { db = _db; _objectSet = db.Set <T>(); }