.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Melody Anderson
Eminent IT
Post New Web Links


Posted By:      Posted Date: August 27, 2010    Points: 0   Category :ASP.Net

using VS2010

using Net4.0

View Complete Post

More Related Resource Links

Creating a Generic Entity Framework 4.0 Repository

With .NET 4.0 right around the corner, I thought it would be cool to download Visual Studio 2010 beta 2 and start playing around with the next release of Entity Framework.

The initial release of Entity Framework came with a great deal of criticism. To make matters worse, there was a large uproar when it was rumored that Microsoft would be abandoning LINQ to SQL, in favor of Entity Framework. This was because, at the time, many developers felt Entity Framework was an inferior technology to LINQ to SQL. To set things right, Microsoft proactively moved forward with improving Entity Framework, in time for the 4.0 release of the .NET Framework. This is good news because my initial impressions, so far, have been nothing but positive.

build repository from SQL 2005? for a Linq, Jquery autocomplete



  I have the a question am going about his correctly I have a database for categories, it has many fields and about 4000 records,  but with a Jquery autocomplete needing speed and the fact that I only need to return a key and category name. I did the following:  (oh just to note, MVC2, Ajax project)


    public class categorySearch
        public Guid Category_GUID { get; set; }
        public string Category_Name { get; set; }


and now for the repository

    public class categoryRepository
        internal List<categorySearch> FindCategory(string searchText, int maxResults)
            List<categorySearch> category = new List<categorySearch>();
            dbWebEntities storedb = new dbWebEntities(); 

            var getcat = storedb.Categories.ToList();

            foreach (var item in getcat)
                category.Add(new categorySearch { Category_GUID = item.Cat_GUID, Category_Name = item.Category_Name});

            var result = from c in category
                         where c.Category_Name.Contains(searchText)
                         orderby c.Category_Name

Metadata: Create a Database Schema Repository with Meta Data Services in SQL Server 2000


SQL Server 2000 Meta Data Services is a repository technology that stores and manages metadata for SQL Server. Instead of building database schemas over and over, Meta Data Services allows you to freeze an entire schema for use in other projects. You can also use these schemas for training, testing, or debugging. In this article, the authors will review the various components of Meta Data Services and show how it can be programmed using a Visual Basic client, XML, and XSLT. They will also show you how to manage and manipulate your metadata by generating a simple database schema using a SQL Server repository.

Alok Mehta and Ricardo Rodriguez

MSDN Magazine May 2003

Generic Repository in EF4 and MVC



I created a generic repository for a EF4 context in MyProj.Domain.

Now I have services with methods like FindById, FindByUsername that use the repositories.

My controllers use these services. 

Should I do the Mapping from Entities to View Models inside the services or in the controller?

The problem is for example, I might have UserEditViewModel and UserSignInViewModel.

In both cases I would need FindById.

So I might use UserService.FindById(id) in the controller and then map it to UserEditViewModel or UserSignInViewModel.

Or the other way around is to have two methods FindById in the service one returning UserEditViewModel and the other UserSignInViewModel.

I tend to do the mapping in the controller using AutoMapper so it is only a code line but I am not sure if this is the correct way.



Managing the SO-Aware Repository with PowerShell

As Jesus mentioned in this post, SO-Aware provides three interfaces for managing the service repository. An OData API in case you want to integrate third applications with the repository. OData is a pure http API that can be easily consumed in any platform using a simple http client library. The management portal, which is an ASP.NET MVC user interface layered on top of the OData API and probably the one most people will use. And finally, a PowerShell provider that also mounts on top of the OData API to allow administrators to automate management tasks over the repository with scripting.  The SO-Aware PowerShell provider, in that sense offers around 40 commands that enables simple management scenarios like registering bindings or services or more complex scenarios that involves testing services or sending alerts when a service is not properly working.   This provider can be registered as an snapin in an existing script using the following command, $snapin = get-pssnapin | select-string "SOAwareSnapIn"if ($snapin -eq $null){ Add-PSSnapin "SOAwareSnapIn"} Once you have registered the snapin, you can start using most of the commands for managing the repository. The first and more important command is "Set-SWEndpoint", which allows you to connect to an existing SO-Aware instance. This command receives the OData service location as first argument, and it looks a

SSAS 2008 Metadata Repository data - User Knowledge base

Hello, We have the SQL Server 2008 Analysis services instance with some databases, cubes, Dimensions, Measure groups, partitions, etc. The business users are find difficulty to search for a particular measure. I mean, it is difficult for them locate a measure from the available cubes; again finding the respective Measure Group/ Folder is not an easy task for them. Also, they need to know the source system of a particular attribute in a dimension, formula for the calculated measure and etc. So, we have planned to develop a knowledge repository, which needs to store the business metadata for the SSAS databases. The user needs to be access this information using the SharePoint site and should help them locate and understand the data. The User Interface needs to be user friendly too. I need your valuable suggestions for the design of this system. Note: I have referenced the below articles http://dwbi1.wordpress.com/2010/01/01/ssas-dmv-dynamic-management-view/ http://social.msdn.microsoft.com/Forums/en-US/sqlanalysisservices/thread/c610850f-16b4-4eaf-9b91-a2d32816f40e

Repository Pattern - Pagination, Sorting

Hi All, envt: MOSS 2007 I have been trying to get my head around on P&P for 2007. It looks fine and adaptable but I do not see pagination / sorting designs implemented there. End of the day in the User Interface we need to provide the ability ot page and to sort the data (ASP.NET Grid in user control). Now in P&P we don't have datatables (weakly typed) but have domain models (strongly typed). Now had this been datatables, I could have retained the datatable in memory (cache / session) and could have gone back to it every time a user sorts / or does paging. But with domain objects we don't have that flexibility but will have to implement the logic on our own. Thats is fine, But i dont see a IQueryable or something of that sort being passed back. 1) Any ideas on how to do this with clean separation of concerns? 2) If we are going IQueryable way of exposing a say - DomainObject.FindByLoginName(id) - Then we dont have an option, but to go to the database for every call? Right ? Is that a good design OR do we other better ideas ? Cheers    

AzMan on Vista with MS-SQL as repository

We have a product with a fairly extensive library of code for creating, updating, and accessing an AzMan repository utilizing ADAM for the backend. It all works quite well. However, it doesn't really work on Vista (apparently due to issues with ADAM) and since AzMan on Vista can use MS-SQL Server as its backend repository, we thought we could just change the connection string and we'd be good to go.   Unfortunately, that doesn't seem to be the case. The store seems to get created correctly, and we can create an application correctly within the store, but when we try to assign the user as policy admin to the application, we get an "ACCESS DENIED" error. Here is a code snippet:   Code Snippet // NOTE: This is set based on whether connecting to ADAM (XP) or MS-SQL (Vista) string connection = "";   // Initialize storeConsole.WriteLine("Initializing store");AzAuthorizationStoreClass azStore = new AzAuthorizationStoreClass();azStore.Initialize(5, connection, null);   Console.WriteLine("Add system policy administrator");azStore.AddPolicyAdministrator(ID.User.Value, null);azStore.Submit(0, null);   // Create System Application GroupsConsole.WriteLine("Adding groups"); // Add "Administrator Group"appGroup = azStore.CreateApplicationGroup("System Administrator Group", null);appGroup.Submit(0, null);   // Add "

EF4 with Repository and Unit of Work patterns - Question about an architecture


Hello All,

I've been reading recently about EF4, and how to build an architecture for asp.net web forms application using it.

I explored using POCOs (self tracking entities), with WCF, but found out that my application will be deployed on a single box (i.e. one tier), so I started reading about logical separation of layers, and came up with the following solution:

  1. DAL layer that contains EDMX model and EF APIs, and also generated context object.
  2. Entities DLL that holds all generated POCO entities using ADO.NET POCO entity generator. (for persistence ignorance, and decoupling entities from DAL).
  3. Business layer that contains a façade for each related group of business functions, the façade will be aware of and using DAL layer. And in each function, it will initiate context and uses different entities to carry out specific job (i.e. function).
  4. UI layer that only calls the business layer façade classes. With no awareness of DAL, but it will be aware of entities (i.e. using entities DLL), as the business layer will return results basically as entity collections.

I want to know what you think about this architecture.

I also read about an architecture that uses repository and unit of work patterns, but what I understand that context object is already implementing a UOF pattern, and also object sets

Advice on repository and ef4



I'm currently working on a new project at work that's built with MVC 2 + EF4 and I'm still fairly new to EF4. I have several repositories for different things and they all follow a pretty similar pattern.

I've follow the video tutorials from Rob Conery Storefront Series, read though peoples blogs but I have a few issues with the way I have implemented the repository methods.

I use POCO's (at least I think they are, POCO's and DTO's seem quite close in comparison) in my application and I have a UI, Service and Data layer.

Before entities I used to use SqlDataReader and create POCO's and populate the values from the results then return a list or object but was getting annoyed by having to manually write SQL, add parameters and do all the left right mapping.

Now I use LINQ to select my data and AutoMapper to map it to my POCOs.

A Typical POCO looks like this:-

    public class LeadSource
        public int Id { get; set; }

        public int CompanyId { get; set; }

        public string Name { get; set; }

        public string Notes

SharePoint 2010 CMIS Repository Web Service returns site collection repositories

Hi. Recently configured the 2010 CMIS Producer for a SharePoint Site Collection. I have enabled the Producer at each site under the collection e.g.
 CaseManager (Master Site)
   Europe (Sub Site)
   Asia (Sub Site)
If I configure the CMIS repository service URL as http://CaseManager/_vit_bin/cmis/SOAP/

Repository Pattern Question. Confused need help.



I been reading Repository Pattern implementation for MVC 2. I am confused due to few things.

Simple Implementation is below.

Tables : Contact has One to Many relation with AssignToCategories
1 - Contacts
2 - AssignToCategories

I have in Model folder


My Questions

1 - We can use ContactRepository directly in View. Why we need IContactRepository for. As long as I know its for Test. Am I right?. If not than whats the purpose.
2 - I have seen ContactService, IContactService. As for as I know its for Business logic. Is there more to it?
3 - Contact has relation to AssignToCategories. Should I put all the data reterival logic within ContactRepository or this AssignToCategories need to have separate Repository and Interface.

I need some help with the concept. Though I have done alot of reading but still confused.

There is one layer called Pipe and filter. Whats the used of that?


Add columns in Approve/Reject screen of Document Repository



We have a document repository in Sharepoint 2010 and we want to add few columns from the Document Repository in the Approve/Reject screen that appears during approving or rejecting a document added.

Please let me know, the steps to achieve this.


Aritra Saha

How to create SharePoint BDC connector for searching custom repository


I am researching how to make a custom respository searchable in SharePoint 2010. I read through documentation on BDC, including Todd Baginski's blog post on .Net Assembly Connector, and get the big picture, but I am missing a lot of details. I wonder if anyone can share their experience and idea.

The custom repository has 3 elements: file (Office document, PDF etc) on the file system, custom metadata and custom ACL in an Oracle database. The requirement is to search the file and its metadata as a signle document and trim the search result using the custom ACL.

The possible approach I have come up so far:

1. Develop BDC .Net assembly connector to index the custom metadata and ACL as an enternal entity, treat the file as an attachment.

2. Develop BDC custom connector to index all 3 elements at once. Possibly starts with indexing the files first and enrich the content stream with metadata and ACL from the database

Would any of these approach work? Any sample code to add file/file stream as attachment? What is the best way to incorporate custom ACL into search?

Any helps and suggestions are appriciated.


Multiple templates for Document Repository



We have a document repository in SharePoint 2010 and we need to have multiple document templates for it. From the Document Repository > Advanced Settings > Document Template - it only lets us have a single document as the template.

We would like users to have the option of selecting from multiple document templates, when they are creating a new document in the document repository.


Aritra Saha

Customize the Document Repository look and feel



We have setup the Document Repository for a Sharepoint 2010 website. Please let us know how we can customize the UI of the document repository. Our customers are looking for a a simpler version of the document repository (w/o the ribbon, check boxes, etc)


Aritra Saha

Not able to Update the MetaData of the Repository in Sharepoint2010 via CMIS Interface


HI ,

objectid =


cmisProperties = objectService.getProperties(strRepositoryId, objectid, null, ocms);

cmisActions = objectService.getAllowableActions(strRepositoryId, objectid,ocms);


//MessageBox.Show(" Modified by: " + GetStringPropertyValue(cmisProperties, "TestingCol"));

cmisProperties = SetStringPropertyValue(cmisProperties,

"TestingCol", "ChangeData");


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend