New answers tagged

0

Your logic works on data, if it worked on nothing, it would be useless. So your logic is going to be coupled to your data; but, that doesn't mean it has to be coupled to the exact format of your data. For example, there are many different kinds of lists: Arrays of objects, Linked lists of numbers, etc. To keep list oriented processing from becoming too ...


0

I post here my currents thought about that problem. So after I started implementing own IDatabaseTransaction I realize that root of the problem not in the transaction, but in the fact that my database layer still contains some business logic(generate some default values while inserting new rows). So my new decision was create and generate all needed data ...


1

In layman's terms: The whole point of relational databases is normalization. Normalization means separating tables into different tables in order to avoid udpate anomalies and to speed up look ups, reduce redundancy etc. So your question really is "should a database be normalized?" and the answer is "of course". Obviously there would be exceptions in a ...


1

You are not thinking too much - your questions are very relevant for the design. But they are not technical questions, they are questions about the requirements. Should your system support payment plans or polygamous marriages? These are not technical questions, these are business decision. As for spouses though it is obvious you have to support unmarried ...


2

It depends is the only real answer here. The reason you ask this question and you are in doubt is because of the fact that you are unclear about the specs to build. Example questions you should ask on orders example. Initial client / product owner request: "We want to see if the orders are paid in the orders screen." Your questions: Cool, sure we can ...


0

I am not sure what purpose requires the has_xxx fields. It is common to use nullable columns where the column may not have a value. You will need to do this anyway for the columns corresponding the the has_xxx fields. If the value is not NULL then has_xxx had better be true, and if the value is NULL, then has_xxs had better be false. This makes the ...


2

What you need is a Unit of Work for your Repositories. The Unit of Work would have an interface similar to public interface IUnitOfWork { ITransaction Start(); void Commit(); void RollBack(); } then your save method on IOrderDataService and IOrderLineDataService would take an ITransaction, becoming: public interface IOrderDataService { ...


1

If you want to avoid SqlTransaction you may use TransactionScope from System.Transactions. This will have the added benifit that any systems that use MSDTC may use the same transaction. It also decouples your database from your business layer allowing the business layer to logically group your transactional data.


1

Persisting data to a date store (DB or other) isn't truly business logic, so I would push the SqlTransactionScope as close to the data layer as possible as it is controlling how the data is persisted/transacted. Your last method of: void Save(Order order, List<OrderLine> orderlines) This makes the most sense as the SqlTransactionScope would be ...


3

If you truly want to keep all of it separate, you could create your own TransactionScope interface and use that in your Create Method. The implementation of said interface then uses the SqlTransactionScope to do the "real" work.


2

I think the worst part of the interface is the fact that there is temporal coupling. Clients of the interface are expected to call methods in the right order, and this order isn't enforced by the type system, so it can only be infered by trial-and-error or by pre-existing domain knowledge. My initial thought is to keep a clean separate interface for the ...


1

Start with some building blocks first: make a class MyConfigData, a simple DTO object, no special logic here. It should hold all the configuration data you want to manage implement methods void SetData(MyConfigData config) and MyConfigData GetData() in your form - these two methods should transfer the data from the DTO object into the form, and vice versa. ...


1

> Is there any clean way of disconnecting the save > logic from the WinForm that will enable me to reuse the save code? Usually this is solved by implementing a Three-tier_architecture Data Object Class with a property of all attributes used in the database and the gui a gui layer that transfers data between Data Object and gui database or ...



Top 50 recent answers are included