public GoodsService() { var dapperDbContext = new DapperDbContext(new SqlConnection(WebConfigSetting.Instance.I200DbConnectionString)); _goodsSummaryRepository = new DapperRepository <GoodsInfoSummary>(dapperDbContext); }
public Response <List <StaffWorkInfo> > getOnlieInfo(StaffOnlieModel model) { Response <List <StaffWorkInfo> > rsp = new Response <List <StaffWorkInfo> >(); try { model.line = getUserLine(model.user); string sql = @"select a.WorkID empno, a.WorkerName empname ,a.PostName job,a.line ,a.shift_no shift , b.Status_flag from m_auxiliary_manpower a LEFT JOIN (select * from mfg_onlinewip where work_date=@work_date ) b on a.WorkID=b.empNo where b.empNo is NULL and a.line=@line and a.IsEnabled='Y' "; if (model.status == 1) { sql = @"select a.empNo ,a.empName ,b.PostName job , a.Status_flag from mfg_onlinewip a ,m_auxiliary_manpower b where a.line=@line and a.work_date=@work_date and a.line=b.line and a.empNo=b.WorkID"; } rsp.data = DapperRepository.Query <StaffWorkInfo>(sql, new { line = model.line, shift = model.shift, work_date = model.workdate }); } catch (Exception ex) { rsp.flag = 0; rsp.msg = ex.Message.ToString(); } return(rsp); }
static void Main(string[] args) { DapperRepository dapperRepository = new DapperRepository("Server=localhost;Database=Northwind;User Id=sa;pwd=1234xxx$@superpwd"); int total = dapperRepository.ReadAll().Count; System.Console.WriteLine($"Total: {total}"); }
public ActionResult Blacklist(string username) { var repo = new DapperRepository(); repo.removeBlacklist(System.Web.HttpContext.Current.User.Identity.GetUserId(), username); return(new EmptyResult()); }
public SqlServerRepositoryFixture() { _settings = new ConnectionStringSettings { ConnectionString = "Data Source=.;Initial Catalog=dapperRepoTest;Integrated Security=true;Application Name=LyphTEC.Repository.Dapper.Tests;", Name = "RepoTest", ProviderName = "System.Data.SqlClient" }; // being explicit here, but this should be default DapperExtensions.DapperExtensions.SqlDialect = new SqlServerDialect(); var mappingAss = new[] { typeof(InvoiceMapper).Assembly, typeof(Address).Assembly }; DapperRepository.SetMappingAssemblies(mappingAss); Cleanup(); var scripts = new[] { "CreateCustomerTable", "CreateInvoiceTable" }; ExecuteScripts(scripts); }
public Response <List <StaffWorkInfo> > getpostinfo(StaffOnlieModel model) { Response <List <StaffWorkInfo> > rsp = new Response <List <StaffWorkInfo> >(); try { model.line = getUserLine(model.user); string sql = @"select a.empNo ,a.empName ,CASE when a.old_line is null then a.line else a.old_line end source_line ,a.line,a.shift_no,a.Status_flag,b.postname job from mfg_onlinewip a ,m_auxiliary_manpower b where a.line=b.line and a.empNo=b.WorkID and a.line=@line and a.work_date=@work_date and a.Status_flag ='0' "; if (model.status == 1) { sql = @"select a.empNo ,a.empName ,a.line,a.shift_no,a.Status_flag,a.ligang_mark,a.ligang_time,b.postname job from mfg_onlinewip a ,m_auxiliary_manpower b where a.line=b.line and a.empNo=b.WorkID and a.line=@line and a.work_date=@work_date and a.Status_flag ='1'"; } rsp.data = DapperRepository.Query <StaffWorkInfo>(sql, new { line = model.line, shift = model.shift, work_date = model.workdate }); } catch (Exception ex) { rsp.flag = 0; rsp.msg = ex.Message.ToString(); } return(rsp); }
/// <summary> /// </summary> public NpocOvsEFvsAdonetvsDapper() { _efRepo = new EFRepository(conetionString); _npocoRepo = new NpocoRepository(conetionString); _adodbRepo = new AdodbRepository(conetionString); _dapperRepo = new DapperRepository(conetionString); }
/// <summary> /// 构造初始化 /// </summary> public SharedService() { var dapperDbContext = new DapperDbContext(new SqlConnection(WebConfigSetting.Instance.I200DbConnectionString)); _accountUser = new DapperRepository <AccountUser>(dapperDbContext); }
//SQLite存储float类型的话会有精度问题 public SQLiteDatabaseTest() { Tools.MappingStrategyHelper.SetStrategy(IdentifierMappingStrategy.Underline); SQLiteHelper.CreateTableIfNoExist("dapper_all_test"); SQLiteHelper.CreateTableIfNoExist("test_table"); _dapper = MockGenerator(); }
/// <summary> /// 初始化 /// </summary> public SettingsService() { var dapperDbContext = new DapperDbContext(new SqlConnection(WebConfigSetting.Instance.I200DbConnectionString)); _smsTemplateDapperRepository = new DapperRepository <SmsTemplates>(dapperDbContext); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddControllers(); //injeção de dependência dos bancos / connectionString Configuration = Injection.Configuration; var connectionString = Configuration["ConnectionStrings:SqlServer"]; //injetando serviço do dapper var dapperContext = new DapperContext(connectionString); var dapperRepository = new DapperRepository(dapperContext); var dapperService = new DapperService(dapperRepository); services.AddSingleton <DapperService>(dapperService); //injetando serviço do entity var entityContext = new EntityContext(connectionString); var entityRepository = new EntityRepository(entityContext); var entityService = new EntityService(entityRepository); services.AddSingleton <EntityService>(entityService); //injetando serviço do datareader var readerContext = new DataReaderContext(connectionString); var readerRepository = new DataReaderRepository(readerContext); var readerService = new DataReaderService(readerRepository); services.AddSingleton <DataReaderService>(readerService); }
public ActionResult Blacklist() { var repo = new DapperRepository(); ViewBag.list = repo.getBlockedUsernames(System.Web.HttpContext.Current.User.Identity.GetUserId()); return(View()); }
private void MockGenerator() { var optionsMock = new Mock <IOptions <DapperDatabaseOptions> >(); var options = new DapperDatabaseOptions { DefaultConnectionName = "default", ConnectionStrings = new Dictionary <string, string> { { "default", helper.ConnectionString } } }; var builder = new DapperDataFeatureBuilder(options); builder.Conventions(convention => { convention .AutoGenerateKey <TimeTest>(x => x.Id) .Ignore <TimeTest>(x => x.Time) .Types(s => s == typeof(TimeTest)) .IsEntity(); }); builder.Build(); optionsMock.Setup(o => o.Value).Returns(options); var loggerFactory = new LoggerFactory(); loggerFactory.AddDebug(LogLevel.Trace); _testContext = new DapperContext(new DapperRuntime(optionsMock.Object, new IDapperMetadataProvider[] { new DapperMetadataProviderInstance(), }) , loggerFactory); _dapper = new DapperRepository <DapperTestEntity>(_testContext); _dapper1 = new DapperRepository <TimeTest>(_testContext); }
public ArrearsDetailsService(DapperRepository repository, IDbConnection context, ArrearsDataService arrearsDataService) { _repository = repository; _context = context; _arrearsDataService = arrearsDataService; }
public MappingStrategyTest() { Tools.MappingStrategyHelper.SetStrategy(IdentifierMappingStrategy.Underline); helper = MySQLHelper.Default; helper.CreateDataBaseIfNoExist("test"); helper.CreateTableIfNoExist(new[] { "dapper_all_test" }); _dapper = MockGenerator(); }
public void SetFixture(SqlCeRepositoryFixture data) { _fixture = data; _customerRepo = new DapperRepository <Customer>(data.Settings); _geRepo = new DapperRepository <GuidEntity>(data.Settings); CustomerRepo = _customerRepo; }
public void SetFixture(SQLiteRepositoryFixture data) { _fixture = data; _customerRepo = new DapperRepository <Customer>(data.Settings); _invoiceRepo = new DapperRepository <Invoice>(data.Settings); CustomerRepo = _customerRepo; }
private DapperRepository <WorkflowInstance> GetWorkflowInstanceRepo() { string dataConnectionString = ConfigurationManager.ConnectionStrings["BaseEAM"].ConnectionString; var dapperContext = new DapperContext(dataConnectionString); var repo = new DapperRepository <WorkflowInstance>(dapperContext); return(repo); }
public void Test() { var dapperRepository = new DapperRepository(); var id = dapperRepository.Insert(new User { UserName = "******" }); }
public LegacySupportTest() { Tools.MappingStrategyHelper.SetStrategy(IdentifierMappingStrategy.PascalCase); helper = MySQLHelper.Default; helper.CreateDataBaseIfNoExist("test"); helper.CreateTableIfNoExist(new[] { "DapperAllTest" }); _dapper = MockGenerator(); }
public UserCouponService() { var dapperContext = new DapperDbContext(new SqlConnection(WebConfigSetting.Instance.I200DbConnectionString)); _couponInfoDapperRepository = new DapperRepository <CouponInfo>(dapperContext); _couponListDapperRepository = new DapperRepository <CouponList>(dapperContext); }
public ActionResult ChangePicture() { var repo = new DapperRepository(); var Id = System.Web.HttpContext.Current.User.Identity.GetUserId(); ViewBag.img = repo.getProfilePicture(Id); return(View()); }
public IActionResult GetCustomer() { DapperRepository _DapperRepo = new DapperRepository(); string test = "Postgrey"; //cust = _DapperRepo.GetUsersWithDapper(); return(Ok(test)); }
public FeedbackService() { var dapperContext = new DapperDbContext(new SqlConnection(WebConfigSetting.Instance.I200SysDbConnectionString)); _checkSysTaskDailyDapperRepository = new DapperRepository <string>(dapperContext); _sysTaskDailyDapperRepository = new DapperRepository <SysTaskDaily>(dapperContext); _sysAccountDapperRepository = new DapperRepository <SysAccount>(dapperContext); }
public ExpensesService() { var dapperDbContext = new DapperDbContext(new SqlConnection(WebConfigSetting.Instance.I200DbConnectionString)); _expensesRepository = new DapperRepository <PayRecord>(dapperDbContext); _expensesCategoryRepository = new DapperRepository <PayClass>(dapperDbContext); _cacheManager = new NullCache(); }
public ActionResult ChangeInfo() { var repo = new DapperRepository(); ViewBag.cityList = repo.getCities(); var info = repo.getProfileInfo(System.Web.HttpContext.Current.User.Identity.GetUserId()); return(View(info)); }
/// <summary> /// 初始化 /// </summary> public MoodService() { var dapperContext = new DapperDbContext(new SqlConnection(WebConfigSetting.Instance.I200DbConnectionString)); _accountUserLogSignDapperRepository = new DapperRepository <LogSign>(dapperContext); _accountBusinessDapperRepository = new DapperRepository <Business>(dapperContext); _accountUserLogInfoDapperRepository = new DapperRepository <LogInfo>(dapperContext); _accountMoodDapperRepository = new DapperRepository <MoodInfo>(dapperContext); }
/// <summary> /// 初始化 /// </summary> public ModuleService() { var dapperContext = new DapperDbContext(new SqlConnection(WebConfigSetting.Instance.I200DbConnectionString)); _moduleDapperRepository = new DapperRepository <Module>(dapperContext); _moduleAccountUserDapperRepository = new DapperRepository <AccountUserModule>(dapperContext); _moduleUserDapperRepository = new DapperRepository <Entity.Model.Modules.AccountUserModule>(dapperContext); _accountBusinessDapperRepository = new DapperRepository <Business>(dapperContext); }
public OnlineMallService() { var dapperDbContext = new DapperDbContext(new SqlConnection(WebConfigSetting.Instance.I200DbConnectionString)); _materialGoods = new DapperRepository <T_MaterialGoods2>(dapperDbContext); _materalgoodspic = new DapperRepository <T_MaterialGoodsPic>(dapperDbContext); _mobileEvaluation = new DapperRepository <MobileEvaluation>(dapperDbContext); _receiveAddress = new DapperRepository <T_Receiving_Address>(dapperDbContext); _receiveAddressAdd = new DapperRepository <ReceiveingAddressAdd>(dapperDbContext); }
/// <summary> /// 根据类型获取Repository对象 /// </summary> /// <typeparam name="T">Repository对象类型</typeparam> /// <returns></returns> protected virtual DapperRepository <T> GetRepositoryInstance <T>(string connStr = null) where T : class, new() { if (_connection == null) { _connection = DbContextFactory.CreateDbConnection(ESqlConnector.MySql, connStr); } var repository = new DapperRepository <T>(_connection, ESqlConnector.MySql); return(repository); }