473,473 Members | 2,138 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Linq to SQL, Generic Reposity Classes

4 New Member
hi, i have the next code:
Expand|Select|Wrap|Line Numbers
  1.     public class ActivationDataRepository
  2.     {   
  3.         private string strConnString;
  4.         private PEGdbDataContext db;
  5.  
  6.         public ActivationDataRepository(string xmlPath)
  7.         {
  8. this.strConnString ConfigurationManager.ConnectionStrings["pecConnectionString"].ConnectionString;
  9.         this.db = new PEGdbDataContext(strConnString, XmlMappingSource.FromUrl(xmlPath));}
  10.  
  11. public IQueryable<ActivationData> FindAllData()
  12.         { return db.GetTable<ActivationData>();}
  13.  
  14. public ActivationData GetActivationData(string id)
  15.         {return db.GetTable<ActivationData>().SingleOrDefault(d => d.Id == id);}
  16.  
  17. public void Add(ActivationData activationData)
  18.         {db.GetTable<ActivationData>().InsertOnSubmit(activationData);}
  19.  
  20. public void Delete(ActivationData activationData)
  21.         { db.GetTable<ActivationData>().DeleteOnSubmit(activationData); }
  22.     }
  23.  
Can someone help me to create a generic class from this one, to be able to create other type objects?
Jul 7 '10 #1
0 885

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Eric Newton | last post by:
Obvious System.Collections.Stack, List, Dictionary, etc. System.Data.DataColumn System.Data.DataParameter and a few more that i'll post in a while -- Eric Newton
0
by: Peter Sestoft | last post by:
C5 is a comprehensive library of generic collection classes for the upcoming version 2.0 of the .Net platform (C#, VB.Net) C5 extends the standard System.Collections.Generic namespace with tree...
11
by: herpers | last post by:
Hello, I probably don't see the obvious, but maybe you can help me out of this mess. The following is my problem: I created two classes NormDistribution and DiscDistribution. Both classes...
0
by: Raterus | last post by:
Hello, Let's say I have the following class Public Class CarCollection : Inherits System.Collections.Generic.List(Of Car) End Class Now, I need to inherit from this class
25
by: Lars | last post by:
Hi, I have a base class holding a generic list that needs to be accessed by both the base class and its subclasses. What is the best solution to this? I am fairly new to generics, but I am...
2
by: shapper | last post by:
Hello, I created 3 few tables that have Many to Many relationships: Posts (PostId PK) Files (FileId PK) PostsTags (PostId PK, TagId PK) FilesTags (FileId PK, TagId PK)
2
by: shapper | last post by:
Hello, I have two tables: TagId, PostId TagId, PostId How can I delete, given a TagId, the record from Tags and all records associated with it in PostTags.
5
by: =?Utf-8?B?Tmlrb2xheSBQb2Rrb2x6aW4=?= | last post by:
Good noon! Maybe anyone of you knows how generate LINQ Classes programmatically? Thanks in advance!
9
by: =?Utf-8?B?cmF1bGF2aQ==?= | last post by:
Hi all: after reading different places/sites about linq... I ran into these questions: 1. What framework do we need to run linq ? (does it depend on what version of visual studio we have?) how...
0
Curtis Rutland
by: Curtis Rutland | last post by:
This isn't a full-blown article, just a quickie. But I couldn't pass up the opportunity to share this insight with people, because it made my coding life sooooooo much easier. ...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.