您将如何构建C#3.0中的桌面应用程序?(How would you architect a desktop application in C# 3.0)
我在C#3.0中创建了一个简单的桌面应用程序来学习一些C#,wpf和.Net 3.5。 我的应用程序基本上从csv文件读取数据并将其存储在SQL服务器CE数据库中。 我使用sqlmetal为数据库生成ORM代码。 我的这个应用程序的第一次迭代是丑陋的,我正在重构它。
这使我想到了我的问题。 你将如何在C#中构建桌面数据库应用程序? 什么是最佳实践?
你是否创建了一个使用sqlmetal生成的代码的数据库抽象层(DAL)? 或者是生成的代码足够抽象?
如果您使用DAL模式,您是否将它设为单身或静态成员? 您是否在DAL模式中使用View-Model-ModelView模式?
如果这似乎是一个长期的开放式问题,我很抱歉,但我最近一直在给这个想法。 我看到很多关于如何在C#中构建企业n层应用程序的例子,但在构建独立桌面应用程序时却没有那么多例子。
I've created a simple desktop application in C# 3.0 to learn some C#, wpf and .Net 3.5. My application essentially reads data from a csv file and stores it in a SQL server CE database. I use sqlmetal to generate the ORM code for the database. My first iteration of this app is ugly as hell and I'm in the process of refactoring it.
Which brings me to my question. How would you architect a desktop database app in C#? What are the best practices?
Do you create a Database Abstraction Layer (DAL) which uses the sqlmetal generated code? Or is the generated code enough of an abstraction?
If you use DAL pattern, do you make it a singleton or a static member? Do you use the View-Model-ModelView pattern with the DAL pattern?
Apologies if this seems like a long open ended question, but I have been giving this a lot of thought recently. I see a lot of examples on how to architect an enterprise n-tier app in C# but not that many on architecting standalone desktop apps.
原文:https://stackoverflow.com/questions/45705
最满意答案
您可以使用dplyr中的
group_by()
函数:library(dplyr) d <- d %>% group_by(group) %>% mutate(value.TA = ifelse(value < quantile(value, 0.99), value, NA)) %>% ungroup() > d # A tibble: 6 x 4 id group value value.TA <int> <fctr> <dbl> <dbl> 1 1 A 1 1 2 2 A 2 2 3 3 A 10 NA 4 4 B 100 100 5 5 B 200 200 6 6 B 1000 NA
数据:
d <- data.frame( id = seq(1, 6), group = rep(c("A", "B"), each = 3), value = c(1,2,10,100,200,1000) )
You can use the
group_by()
function from dplyr:library(dplyr) d <- d %>% group_by(group) %>% mutate(value.TA = ifelse(value < quantile(value, 0.99), value, NA)) %>% ungroup() > d # A tibble: 6 x 4 id group value value.TA <int> <fctr> <dbl> <dbl> 1 1 A 1 1 2 2 A 2 2 3 3 A 10 NA 4 4 B 100 100 5 5 B 200 200 6 6 B 1000 NA
Data:
d <- data.frame( id = seq(1, 6), group = rep(c("A", "B"), each = 3), value = c(1,2,10,100,200,1000) )
相关问答
更多-
您可以使用dplyr中的group_by()函数: library(dplyr) d <- d %>% group_by(group) %>% mutate(value.TA = ifelse(value < quantile(value, 0.99), value, NA)) %>% ungroup() > d # A tibble: 6 x 4 id group value value.TA如果要使用聚合函数,则需要以不同方式定义它。 Pandas会将向量传递给函数,函数需要输出单个值。 所以: def get_num_outliers (column): q1 = np.percentile(column, 25) q3 = np.percentile(column, 75) return sum((column
q3)) 然后这样称呼它: df.groupby('group').agg([get_num_outliers]) If you want ... 从数组中提取上四分位数据并将其放入新列(Extracting the upper quartile data from an array and placing it in new column)[2021-10-14]
对于初学者来说,为了使这个解释更简单,我将假设最后一行数据在第100行。 填充所有订单项的上四分位数值 首先,您需要使用Quartile公式; 但是,由于您想在bin中找到上四分位数,因此您必须使用数组公式。 将此公式放在UQ列中(放在单元格D2中并向下拖动)。 输入公式时请确保在按Enter键之前按Ctrl + Shift =QUARTILE(IF($C$2:$C$100=C2,$A$2:$A$100,""),3) 这个公式的第一部分, $C$2:$C$100=C2是你的条件。 在满足这一条件的情况下, ...只是底部附近缺少WHERE子句: SELECT T.IU, 0.75*(SELECT Max(GM) FROM tblFirst250 WHERE tblFirst250.GM IN (SELECT TOP 25 PERCENT GM FROM tblFirst250 WHERE tblFirst250.IU = 1 AND GM Is Not Null ORDER BY GM)) + 0.25*(SELECT Min(GM) FROM tblFirst250 WHERE tblFirst250.GM I ...我认为您可以通过编写更精确的函数然后使用aggregate来获得结果来加快速度。 如果您想要一个更基于列表的方法,您也可以使用它,这可能对您的下一次使用更有用。 我认为它仍然会很慢,但不如循环慢。 # Here is what you gave me originally set.seed(1) sk<-as.factor(sample(c("sick A","sick B","sick C","sick D"),1000,replace=T)) md<-as.factor(sample(c("med 1" ...怎么样:你把值转换为decimal(10,0) - 十进制定义精度为10位数,但零刻度。 看看这里: MySQL中的精度和比例我在下面的语句decimal(18,8)它们改为decimal(18,8) 。 此外,你不需要像(50 / 100)这样的东西 - 只需使用0.50 cast(substring_index( substring_index( group_concat(`lulusanmagisterrangkuman`.`IPK` ...如果您在链接的页面上进一步阅读(或ctrl-f代表“异常值”),您会看到: whis : float, optional Proportion of the IQR past the low and high quartiles to extend the plot whiskers. Points outside this range will be identified as outliers. If you read further on the page you linked (o ...要按日期获得单个变量的四分位数,可以使用ave函数: df$qPB <- ave(df$PB, df$Date, FUN= function(i) cut(i, breaks = quantile(df$PB, c(0,.25,.5,.75,1)),include.lowest = TRUE) # a minor addition to aggregate aggregate(df$fwd_rtn, list("qPB"= ...excel的VBA代码以我的方式找到四分位数和四分位数(VBA code for excel to find quartile one and quartile three my way)[2023-06-02]
我的第一个想法是你可以使用四分位数,但这并不总是给出相同的答案。 如果你想忽略中间值(对于奇数个点)和中间两个值(偶数个点),你可以尝试找到像这样的子范围的中位数: - =MEDIAN(INDEX(A2:A10,1):INDEX(A2:A10,INT((COUNT(A2:A10)-1)/2))) 获得较低的中位数 =MEDIAN(INDEX(A2:A10,COUNT(A2:A10)-INT((COUNT(A2:A10)-1)/2)+1):INDEX(A2:A10,COUNT(A2:A10))) 获得上限 ...用分数表示分位数与四分位数(quantile vs quartile in lay terms)[2022-03-20]
累积密度函数为您提供随机变量在某个值或低于某个值的概率。 分位数函数与此相反。 即你给它一个概率,它告诉你随机变量值。 因此, 中值是概率值为0.5时分位数的值。 四分位数是概率为0.25,0.5和0.75的分位数的值。 因此,通常,您可以使用分位数 。 四分位数是一个特例。 The cumulative density function gives you the probability of a random variable being on or below a certain value. The ...相关文章
更多- 摘抄---Multimedia Streaming on Microsoft Windows CE 3.0
- 精通EJB3.0
- C#开发微信公众化平台
- Redis Desktop Manager客户端使用教程
- Chapter 9 - Securing Your Application -- Professional ASP.NET MVC 1.0
- 用C#捕捉键盘和鼠标
- C#开发微信公众平台-就这么简单(附Demo)
- Becoming a data scientist
- C#开发微信公众平台-就这么简单(附Demo)
- Quitting an application - is that frowned upon?
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)