data-access

Generics in c# & accessing the static members of T

Hi there! My question concerns c# and how to access Static memebers ... Well I don't really know how to explain it (wich kind of is bad for a question isn't it?) I will just give you some sample code: Class test<T>{ int method1(Obj Parameter1){ //in here I want to do something which I would explain as T.TryParse(...

Split data access class into reader and writer or combine them?

This might be on the "discussy" side, but I would really like to hear your view on this. Previously I have often written data access classes that handled both reading and writing, which often led to poor naming, like FooIoHandler etc. The rule of thumb that classes that are hard to name probably are poorly designed suggests that this is...

What are you currently using for data access?

What particular method/application are you using to communicate between your application and a database? Custom code with stored procedures? SubSonic? nHibernate? Entity Framework? LINQ? ...

How can I generate database tables from C# classes?

Does anyone know a way to auto-generate database tables for a given class? I'm not looking for an entire persistence layer - I already have a data access solution I'm using, but I suddenly have to store a lot of information from a large number of classes and I really don't want to have to create all these tables by hand. For example, g...

Programmatically accessing Data in an ASP.net 2.0 Repeater

This is an ASP.Net 2.0 web app. The Item template looks like this, for reference: <ItemTemplate> <tr> <td class="class1" align=center><a href='url'><img src="img.gif"></a></td> <td class="class1"><%# DataBinder.Eval(Container.DataItem,"field1") %></td> <td class="class1"><%# DataBinder.Eval(Container.DataItem,"field2") %></td> ...

data access in DDD?

After reading Evan's and Nilsson's books I am still not sure how to manage Data access in a domain driven project. Should the CRUD methods be part of the repositories, i.e. OrderRepository.GetOrdersByCustomer(customer) or should they be part of the entities: Customer.GetOrders(). The latter approach seems more OO, but it will distribute ...

WCF DataContracts and underlying data structures

I am wondering what makes sense in relation to what objects to expose through a WCF service - should I add WCF Serialization specifications to my business entities or should I implement a converter that maps my business entities to the DataContracts that I want to expose through my WCF service? Right now I have entities on different lev...

Sharepoint Item Level Access & performance

i have created a workflow activity that do give the item creater of a specific list full control on the item and set everyone else to read only access (permission) someone told me that doing it this way (if i have a lot of users) the performance will go down dramatically is that correct ?!! if yes what is the best solution to create...

What's the best database access pattern for testability?

I've read about and dabbled with some including active record, repository, data transfer objects. Which is best? ...

What are best practices to implement security when using NHibernate?

Traditionalist argue that stored procedures provide better security than if you use a Object Relational Mapping (ORM) framework such as NHibernate. To counter that argument what are some approaches that can be used with NHibernate to ensure that proper security is in place (for example, preventing sql injection, etc.)? (Please provide...

Controlling access to an internal collection in c# - Pattern required

This is kind of hard to explain, I hope my English is sufficient: I have a class "A" which should maintain a list of objects of class "B" (like a private List). A consumer of class "A" should be able to add items to the list. After the items are added to the list, the consumer should not be able to modify them again, left alone that he ...

Unable to close OledbDataReader to Sybase Database in VB.NET

I don't seem to be able to close the OledbDataReader object after reading data from it. Here is the relevant code - Dim conSyBase As New OleDb.OleDbConnection("Provider=Sybase.ASEOLEDBProvider.2;Server Name=xx.xx.xx.xx;Server Port Address=5000;Initial Catalog=xxxxxxxxxx;User ID=xxxxxxxx;Password=xxxxxxxxx;") conSyBase.Open() Dim cmdSy...

Resources for code generation of database objects

I am working a project where I need to generate a series of classes to represent/access data in the database. Third party projects such as hibernate or subsonic are not an option. I am new in this subject domain, so I am looking for information on the topic. The project is in .net and I am using MyGeneration. I am primarily looking for i...

MS Access Data Access Limitations

I have a project right now where I'd like to be able to pull rows out of an Access database that a 3rd party product uses to store its information. There will likely be a small number of users hitting this database at the same time my "export" process does, so I'm a little concerned about data integrity and concurrent access. Will I li...

Java: Advice on handling large data volumes. (Part Deux)

Alright. So I have a very large amount of binary data (let's say, 10GB) distributed over a bunch of files (let's say, 5000) of varying lengths. I am writing a Java application to process this data, and I wish to institute a good design for the data access. Typically what will happen is such: One way or another, all the data will be ...

JAVA Swing client, Data Access to Remote Database; Ibatis

I've got a Java client that needs to access a remote database. It is the goal to hide database credentials from the user and not hardcode any credentials within the code. Therefore, the database access will probably have to be on the server side. I'm restricted to use Ibatis as a data abstraction framework. Apart from that I have JBoss ...

Data recovery mechanics, is it possible to recover items from the hard drive?

I've been using some data recovery tools like Diskinternals Uneraser. I've been wondering how we can recover things on a hard drive programmatically? Is there specific disc access mechanics, patterns, API to use? Is it something I can do in C#? ...

Design problem: shared, synchronized, data access in application... the best approach?

I have a web application (asp.net) where work items are submitted and allocated to users according to their workload. A user's workload is calculated using an algorithm based on the number of items currently allocated to the user (and some other factors). Each new item is allocated to the user with the lowest current workload, increasin...

How in .Net do I Import Values from a CSV in the format I want using OleDB?

I have a CSV file that has a column that contains strings that look like integers. That is they should be dealt with as strings, but since they are numbers they appear to be imported as integers (dropping off the leading zeroes). Example Data: 0000000000079 0000999000012 0001002000005 0004100000007 The problem I'm seeing is that t...

LINQ To SQL entity objects as domain objects

Hi everyone. Clearly separation of concerns is a desirable trait in our code and the first obvious step most people take is to separate data access from presentation. In my situation, LINQ To SQL is being used within data access objects for the data access. My question is, where should the use of the entity object stop? To clarify, I ...