首页 \ 问答 \ 您将如何构建C#3.0中的桌面应用程序?(How would you architect a desktop application in C# 3.0)

您将如何构建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
更新时间:2023-10-28 09:10

最满意答案

您可以使用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)
)

相关问答

更多

相关文章

更多

最新问答

更多
  • 您如何使用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)