我想建立一个结构,使我的国家调查股与数据库互动,而不为《国际调查准则》撰写多余的编码。
I was wondering if someone can tell me what would be the best way to bring my application to the foreground if a mutex was not able to be created for a new instance. E.g.: Application X is running ...
我想建立一个结构,使我的国家调查股与数据库互动,而不为《国际调查准则》撰写多余的编码。
利用商务目标/用户界面/商业逻辑/数据获取结构。
BO------UI
| |
--------BL
| |
--------DA
起点是界定一些简单的umb规则。 umb的一条良好规则是,在表格类别中尽量少有密码。 表格类别中的所有代码都应当是真正的基本数据。
我个人喜欢使用DAO patterns,用于组织我的数据库存取逻辑。 这种格局必然地概括了使用和复制的代码;储存了数据,因此可以轻易转换和改变。 根据数据库的复杂性,我通常每个表格都有1个DAO,但对于简单的数据库来说,甚至每个数据库只有1个DAO。
MVC is a popular way to seperate presentation and other logic as well, but may be overkill for a simple project. Use cases are also a good way to encapsulate logic and seperate it out from the form.
基本框架可看一例(注:不完整!) “DAO”条款全文改为适当执行。 该守则的要点是显示,<代码>上没有数据库逻辑。 表格代码>类别,当纽扣(或以任何方式)将国库测绘为一项行动时,便是一个简单的单行。 如果你决定从数据库储存中抽取,以存档,则不必写<代码>。 fileMyDAO : IMyDAO category, 然后由工厂回来。 通知说,如果你这样做,《国际统一法》的法典没有任何变化!
public interface IMyDAO
{
void InsertData(int data);
}
public class SqlMyDAO : IMyDAO
{
public void InsertData(int data) { throw new NotImplementedException(); }
}
public class DAOFactory
{
public static IMyDAO GetMyDAO() { return new SqlMyDAO(); }
}
public class MyForm : Form
{
private void Button_Click(object sender, EventArgs e)
{
DAOFactory.GetMyDAO().InsertData(123);
}
}
http://msdn.microsoft.com/en-us/library/ms752347.aspx” rel=“nofollow”>Data Bled是你应当研究的内容。 这将引导你们进行更多的研究,但你肯定会知道你们所需要的工作人员。
b 能够利用原始结构:
BusinessObjectLayer BusinessLogicLayer DataAccessLayer UILayer
那里已经建立了免费建筑框架,等待使用。
http://nidoframework.codeplex.com”rel=“nofollow”> Nido framework - more Flex, but only f或their Back end structure
或
I was wondering if someone can tell me what would be the best way to bring my application to the foreground if a mutex was not able to be created for a new instance. E.g.: Application X is running ...
I ve successfully created an app that minimizes to the tray using a NotifyIcon. When the form is manually closed it is successfully hidden from the desktop, taskbar, and alt-tab. The problem occurs ...
Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...
I have a DataTable that has several DataColumns and DataRow. Now i would like to handle an event when cell of this DataRow is changed. How to do this in c#?
How do you force a DataGridView to release its reference to a bound DataSet? We have a rather large dataset being displayed in a DataGridView and noticed that resources were not being freed after the ...
I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...
When I m trying to change the default Image of a Control on Windows Forms in Form Designer (no matter where on which control) I get this error: Error message: An item with the same key has ...
I have a Winforms application coded in VS C# 2008 and want to insert a WPF window into the window pane of Winforms application. Could you explain me how this is done.