Store Helper Classes In A Separate Assembly?

Feb 21, 2010

I just want to know if anyone stores their helper classes or methods in a separate assembly and why...just for clean management of them? I've seen so many posts about using a helper folder inside your MVC project and that brings me back to the messy old days in ASP.NET where people were using an App_code folder instead of cleanly separating things out physically like this into its own project. And likewise nobody doing real architecture is going to put models in some folder in your MVC web assembly. They would go in MyApp.DataLayer assembly or MyApp.Models or something like this.

View 5 Replies


Similar Messages:

Web Forms :: Get Values From Helper Classes?

Jun 1, 2010

I am learning how to work with BLL and DAL

I have 2 class files in BLL and using DAL i am connecting to the sql database

in BLL i have a class called productsHelper.cs and using GetProducts() method used to fetch records from database

products.cs - have all insert,edit,delete methods

I want to bind all products to gridview

But I couldnt find how to do that.how to get those methods to my aspx.cs page from class files.and write code in there.

View 5 Replies

MVC - Use The New Html Helper Extension Serialize() From The Future Assembly

Aug 31, 2010

I'm trying to use the new Html helper extension Serialize() from the furthure assembly..

<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<List<MvcApplication2.Models.ProductViewBinding>>" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Import Namespace="Microsoft.Web.Mvc" %>>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Index</title>
</head>
<body>
<div>
<% using (Html.BeginForm("Index", "Products", FormMethod.Post))
{ %>
<% int codeIndex = 0;
foreach (var item in Model)
{ %>
<%: Html.TextBox("Encryption[" + codeIndex + "].Value") %>
<%: Html.Serialize("Encryption[" + codeIndex + "].ID", item.ID) %>
<% codeIndex++;
} %>
<%: Html.SubmitButton("Click meh!") %>
<% } %>
</div>
</body>
</html>
Model
[Serializable]
public class ProductViewBinding
{
public object ID { get; set; }
[NonSerialized]
public object _value;
public object Value
{
get { return this._value; }
set { this._value = value; }
}
}
Controller
[HttpPost]
public ActionResult Index([Deserialize] List<ProductViewBinding> Encryption)
{
return View("Index", Encryption);
}

It returns null when posted... but if I remove the [Deserialize] attribute it returns as it should but with the ID still encrypted.

View 1 Replies

Accessing Controls From Separate Classes

Jun 23, 2010

I have an ASP.NET Web Site I am creating in Visual Web Developer 2008 Express using Visual Basic as the language. It is actually a rewrite-with-mods of an existing ASP script and I'm trying to chew what I've bitten off. I created my page with a text box (txtOutput) on it and since the end product is very complex, and it's generally good practice to separate like functions, I have created 4 separate classes in the App_Code section.

My main page is Sync.aspx and has a code file Sync.aspx.vb with it.

One of my code files is SyncDatabases.vb and in it I have created

Public Class SyncDB

In that class I have created some routines such as

Public Function ReadMSDB(ByVal SQLString as string) as Boolean

In this routine I want to put information in my text box txtOutput on the main form (the default - Form1).

My problem is that if I try:

Form1.txtOutput.Text = "Hello world"

or just

txtOutput.Text = "Hello world"

it says Name 'Form1' (or 'txtOutput') is not declared. I am sure I am missing something simple but have no clue what it is. I assume it's the fact that the write command is in a file (class?) outside the file (class?) containing the page itself but I don't know how to address it properly.

View 4 Replies

What Is The Best Way To Separate Classes Under The App_Code Folder

Aug 10, 2010

I have an application which contains different modules from different databases, for instance, I have a table called "ITEMS" in each database. When I create the classes for the table ITEMS I wonder how I can differentiate among them.

For instance, for now, I have "ItemDetails.cs" under App_Code folder BUT I need to create another "ItemDetails.cs" class which will reference the table ITEMS from a different database. If I create folder under the App_code the class name still remains the same.

I could add an acronym in front the class to differentiate which database I am working from but that makes the class name too long.

View 2 Replies

Architecture :: Can An Assembly Contain More Than One Classes?

May 12, 2010

I want to know Can an assembly contains more then one classes?

View 1 Replies

Membership - Profile In A Separate Assembly

Jun 1, 2010

I have a web application which uses membership and profiles. I successfully used the WebProfileBuilder extension, so my profile class is correctly generated, and is working nicely. However, after a new request of my client, I need now to move that profile management part into another assembly (so I'd be able to get profile information in a windows service running on the same machine).

What I made is created the new assembly, moved my generated profile file, and tried to use it from the other assembly, but without any success. I always get a SettingsPropertyNotFoundException. My thought is that the profile system doesn't know where to find its connection information, so I tried to add the connectionstring and provider in the app.config of this assembly, but this doesn't seem to work.

View 2 Replies

MVC 2 - Views In Separate Assembly - No Intelligence

Feb 17, 2010

I have two projects in my solution: a) MVC Application b) Class Library. The class library acts as a plugin, so it contains views. The main problem is that I have no intellisense in the view's markup for my classes contained within the class library (the same assembly as the views). In the beginning I couldn't even write <%= Html.RenderAction... %>. I've solved that by adding a Web.config file to the class library with the following section:

<configuration>
<system.web>
<compilation debug="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
</system.web>

Now it recognizes Html.RenderAction, etc in the view's markup. However I've no idea how to get access (with intellisense) to my classes contained within the same assembly as the views

View 3 Replies

Membership Store VB.NET Helper Class

Jan 24, 2011

I need to use the standard ASP.NET membership database tables in plain winform projects, and I DO NOT WANT to add the ASP.NET dll, because my app must run with .NET Client framework, and not full framework. Does somebody knows of a helper class that links to ASP.NET tables in plain vanilla VB ot c# code? I mean with functions equivalent to CreateNewUser, CheckUserCredentials, isUserinRole, RoleList etc...

View 1 Replies

Assemblies - Embed Js / Css Images Into Separate Assembly To Read From Website

Sep 3, 2010

I'd like to create a class library project where embed resources like js, css and maybe image files. I would compile it and copy the dll into the bin folder of my web site to include the resources into my pages with GetWebResourceUrl.

I tried with an assembly that have no .cs files, but it doesn't seem to work, I can't see the namespace of the assembly in the web project.

View 1 Replies

Forms Data Controls :: Gridview Check Missing 1st One With Gridview Helper Classes

Feb 23, 2010

im reading checkbox value which is checked on my gridview but as per my code is missing the 1st one which on top but i select from the middle then it is working fine here is link for gridviewhelper classes [URL] and im calling this code from gridviewhelper classes on page load event

Dim helper As New GridViewHelper(Me.GridView2)
helper.RegisterGroup("heading", True, True)
AddHandler helper.GroupHeader, AddressOf helper_GroupHeader

and here is my code

Dim sc As New StringCollection()
Dim id As String = String.Empty
For i As Integer = 0 To GridView2.Rows.Count - 1
'loop the GridView Rows
Dim cb As CheckBox = DirectCast(GridView2.Rows(i).Cells(2).FindControl("CheckBox2"), CheckBox)
'find the CheckBox
If cb IsNot Nothing Then
If cb.Checked Then
id = GridView2.Rows(i).Cells(1).Text
sc.Add(id)
MsgBox(id)
End If
End If
Next

View 1 Replies

WCF / ASMX :: Electronic Store - Two Separate Projects For Entity?

Aug 11, 2010

Nowadays I'm building an electronic store where I work. We have a few other online applications for the e-marketing and e-commerce activities, such as payment forms of campaigns we're spending, various portals etc. There is a common entity in our sites : VISITOR. We save a record for each visitor containing various information. Also, we have another entity - PURCHASE - the purchase of a product. It also exists in some of our DBs, Depending on applications. Today, when I'm designing a new store I decided to get WCF into business.

The purpose is to union all the application workings with PURCHASE and VISITOR. Since there are several applications that use the entity VISITOR and PURCHASE, I thought to develop VISITOR WCF and WCF for PURCHASE. I thought to create them in two separate projects - each one on its own WCF SERVICE APPLICATION, and to invoke them from my new shop as a beginning and in the future from the other applications. Both WCFs will work on the same DB that will contain and work with VISITOR and PURCHASES.

View 9 Replies

Which Classes / Objects Store Details About The User Of A Page

Jan 28, 2010

which classes/objects store details about the user of a page: things like IP number etc.

View 2 Replies

Web Forms :: Modified CreateUserWizard To Store Addition Data Into Separate Table

Jan 20, 2011

I am modified CreateUserWizard Template to accept additional user information such as address, city, state and zip. I wanna store this additional data into a table i create call UserInformation. The table has UserId as it's primary key and it's also a foregin key to apsnet_Users. The tables also has an Address, city, state and zip column/field. I have an event that is called after a new User is Created and it is at this point where i wanna write the Address, City, State and Zip to the the database. What is the best way to write the data to the database..

[Code]....

View 1 Replies

C# - Store Class Instance (helper Class) In Cache?

Jun 30, 2010

I have a class instance which is created by using Activator.CreateInstance() method. That class instance contains helper methods which are frequently used throughout the application. In order to avoid creating the instance multiple times, I'm just thinking about implementing an appropriate caching mechanism. The following consideration should be taken into account:

1) I can't use static class and methods.
2) There are around 6 instances (1 instance per class) per App Domain.

View 4 Replies

Recompile The Assembly To Use The New Mono Assembly Versions The Assembly Is Closed Source?

Feb 18, 2010

I have recently discovered that I am affected by this bug http://www.mail-archive.com/mono-bugs@lists.ximian.com/msg71515.html

Well,at http://www.mail-archive.com/mono-bugs@lists.ximian.com/msg71529.html they say the work around is to create a global policy assembly and redirect the assemblies that way since it is not read from the web.config.

How do you actually do what they describe there? There is a huge documentation gap in that area with Mono.Also,I can't just recompile the assembly to use the new Mono assembly versions because the assembly is closed source.(but it does work with Mono.)

View 1 Replies

MVC :: Store Model In Separate Class Library- Pass Model Objects?

May 19, 2010

I'm building an MVC 2 RTM app, and I want to be able to share my model across applications. I'd *like* to be able to implement it like:ASP.NET MVC2 app (holds Views and Controllers)Class library to hold Model(s)WCF app to handle the data transactions with the models via different data stores across apps I had the MVC app working fine, but I wanted to abstract the data stuff and be able to work with the model across apps through the WCF site, so I created a class library project and moved all of the Models classes into that and set-up a WCF app, then added project references to the MVC and WCF apps that point at the class library. The idea was I can create services that take and return objects from the model via method calls across apps. It appears that everything's wired up correctly in the MVC project, so I'm passing the objects stored in the Models class library between controllers and views and everythig is compiling just fine, but for some reason the data is not being passed back from the views to the controller on POST -- all of the properties in the classes are null or empty.

When I debug the app, I can see that the values are stored in the model data dictionary but not the model object itself. What am I doing wrong? Am I on the wrong path, or missing something obvious (to some)?

View 2 Replies

DataSource Controls :: Display Results From Two Separate Tables In Two Separate Databases?

Jan 14, 2010

I have access to two seperate databases (mySQL) located on two servers. I need to get the data, link the tables on a key field and display the results in a datagrid. My challenge is that if the search criteria changes for the display it affects rows returned from on table and should thus automatically affect the linked table and resulting data returned.

what the best approach would be to achieving this? So far I have set up a dataset with a dataadapter and table for each connection and then linked the tables in the dataset. The problem that I'm having is getting the linked resultsets to work.

On my form I have the datagrid with two Objectdatasources one for each dataadapter and i believe that's where I'm going wrong...

View 1 Replies

Visual Studio :: What Is The Difference Between Designer Classes And T4 Template Generated Classes

Jan 11, 2010

I am new to LINQ. when we drag tables we get a dbml file and designer file.

For example DataClasses1.dbml and DataClasses1.designer.cs.

Once we have them then we can start using our LINQ Queries.

In my company project I do not see this designer files and instead there are .tt files which were used as templates to greate ABC.generated.cs files. Is this same as designer class?

View 3 Replies

C# - Class Structure With LINQ, Partial Classes, And Abstract Classes

May 17, 2010

I am following the Nerd Dinner tutorial as I'm learning ASP.NET MVC, and I am currently on Step 3: Building the Model. One part of this section discusses how to integrate validation and business rule logic with the model classes. All this makes perfect sense. However, in the case of this source code, the author only validates one class: Dinner.

What I am wondering is, say I have multiple classes that need validation (Dinner, Guest, etc). It doesn't seem smart to me to repeatedly write these two methods in the partial class:

[code]....

This doesn't "feel" right, but I wanted to check with SO to get opinions of individuals smarter than me on this. I also tested it out, and it seems that the partial keyword on the OnValidate method is causing problems (understandably so). This doesn't seem possible to fix (but I could very well be wrong).

View 1 Replies

C# - Can Base Classes See The Protected Fields Of Derived Classes

Aug 11, 2010

I don't know if this has to do with how FindControl works or how scope works. But my base class is having a hard time seeing the fields of child classes. Currently I'm planning have the derived class set a property in the base class, but there are a lot of derived classes, so that isn't a very attractive solution.

[code]....

View 4 Replies

Web Forms :: Using C# Classes Vb Classes Together In VS2008 / 3.5 Project

Mar 24, 2010

Can I use VB and C# classes together in the same asp.net 3.5 project?

View 3 Replies

Map Model Classes To ViewModel Classes Or Aggregate Model Classes In ViewModel Classes

Dec 15, 2010

I'm curious as to what people consider better practice, between duplicating model structure in the view model and using a mapping tool to move data between the two, or aggregate the model inside the view model, i.e. have a property on the view model class that is a reference to the actual model. Which is considered a better approach in general?

View 1 Replies

MVC :: How To Separate Project Into Separate Layers

Feb 2, 2010

I am beginner to ASP.NET MVC.

We are doing project in Asp.Net MVC and Nhibernate.

How to seperate my project in to layers ? how to design classes ?

should i followany patterns ? repository patterns ?

View 3 Replies

Visual Studio :: Assembly Editor - Create A First Blank Page For An Assembly Project?

Oct 11, 2010

i was wondering if visual studio 2010 can be used as an assembly editor too????if yes where do i have to go to create a first blank page for an assembly project?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved