C# - Dynamic Inheritance Using A Factory?
Oct 11, 2010
I think I know the answer to this but hoping someone has a neat solution. We are currently using two kinds of drop down controls (telerik and .net). I'm hoping to combine these into one control but struggling with a user friendly design.
Ideally the control would be created in the design file with a bool property of say "SimpleBox", to determine which kind of control to inherit. The instantiation would then be generated in the code behind design file and the constructor would then dynamically load the base (which isn't possible). The easy solution would be for me to create a IDropDown interface then have a factory create the correct one. The only real problem with this is the fact the instantiation has to be manually written every time. Which is a hassle, and does not speed up our process at all.
Although it isn't directly possible i'm looking for a solution along the lines of a factory which is ran inside the object constructor for setting the base, based on a bool property.
View 1 Replies
Similar Messages:
Sep 11, 2010
tell me where I could initialize (in the mvc code) the hibernate factory?
View 1 Replies
Jun 14, 2010
I'm writing an MVC app and want to have a central DataBase factory class to provide all my DB connections, something like this:-
[Code]....obviously I'll have to instanciate this every time I need to use it, so I was thinking of making it a static class:-
[Code].... so that instead of my controller code saying
[Code].... I can just say
but would this cause a memory leak? I'm sure I remember reading somewhere that if a static class creates objects that persist beyond it's methods and return those (esp things like DB connection objects) these won't get garbaged collected when the calling method is disposed of as they were created/referenced outside the scope of that calling (controller action) method and so will hang around in memory?
var tableObject = DatabaseFactory.GetDatabaseTable();
List<DbRecord> records = tableObject.Table.ToList();
View 9 Replies
Apr 1, 2011
I've noticed that a request to 'favicon.ico' is being passed to my ASP.net MVC controller factory when using Google Chrome and the Visual Studio Development Server. The 'controllerType' parameter has a value of 'null' which is unsurprisingly resulting in an unhandled exception and which I only know about because of an error log.where the request is coming from and why ASP.net is letting it get to the controller factory? CSS files and images for example are being correctly filtered out.
View 2 Replies
Jul 17, 2010
I visited this Link to study about Factory design pattern.http://wiki.asp.net/page.aspx/310/factory/ But i am confused about it still. What i understood is that we must use an Interface to define a class .In the interface we will give the prototype of functions and later on we will define it in concrete class. Is that simple concept is Factory design pattern ?
View 13 Replies
Jan 22, 2010
I am developing an application in ASP.NET 3.5. i am exporting data to excel file using some interops dll's. earlier i have developed the applicaion in Windows 2003 Server. at that time i could able to export the data to excel file. but recently i have upgraded my pc to Vista version.it is working fine in my localhost. when i deploy the application in IIS iam getting this error. like "Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.". can any one let me know the resolution for this error.
View 1 Replies
Feb 22, 2011
I wasn't getting this error before on localhost, but now it's occurring when I uploaded my ASP.NET C# web app to the server. I've been looking for an answer how to fix this, but cannot seem to get rid of it. I have a Microsoft.Office.Interop.Excel DLL which I am trying to use to export data from a dataset to excel. I was told by customer service that the domain that I have registered is hosted on a 32-bit server.
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154.
Source Error:
Line 499: object misValue = System.Reflection.Missing.Value;
Line 500:
Line 501: xlApp = new Excel.ApplicationClass();
Line 502: xlWorkBook = xlApp.Workbooks.Add(misValue);
Line 503: xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
View 2 Replies
May 17, 2010
I am having troubles understanding the purposes of using Factory pattern, I understand Factory pattern uses Factory class that has methods to return concrete objects. But why don't I simply use new opertor to create concrete objects? Some articles suggest Factory methods could return objects of different concreate classes, I can do the same thing by using switch statement.
Also are there classes in .Net framework already implementing Factory pattern? I think that will give me a better ideas why it is useful.
View 5 Replies
Jan 16, 2014
I am using below code to find find no of slides in .ppt,.pptx and .pot file .
Microsoft.Office.Interop.PowerPoint.Application pptApplication = new Microsoft.Office.Interop.PowerPoint.Application();
Microsoft.Office.Interop.PowerPoint.Presentation pptPresentation = pptApplication.Presentations.Open(path, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
count=pptPresentation.Slides.Count;
It is working file in my system , but online it is showing error :
Retrieving the COM class factory for component with CLSID {91493441-5A91-11CF-8700-00AA0060263B} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
View 1 Replies
Jul 30, 2010
I am facing one problem that when i try to access a page in the website, i am getting the following error,
Retrieving the COM class factory for component with CLSID {58A02778-16FC-423D-91AC-4619BD71257F} failed due to the following error: 80040154.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {58A02778-16FC-423D-91AC-4619BD71257F} failed due to the following error: 80040154.
Source Error:
[Code]....
Source File:
d:IEL_HELPDESKIEL-HelpDeskIELHelpDeskl_ticket_approval.aspx.cs
Line: 23 Stack Trace:
[Code]....
I went to that particular class file which is in the form of dll and in codebehind page of that class , builded the application, but it is not showing any compile time errors, but i put a break point it fails.
View 2 Replies
Jun 8, 2010
Retrieving the COM class factory for component with CLSID {86A3FE22-515C-45BF-B489-07DEEB03E2D6} failed due to the following error: 80040154.this is error message in my page in asp.net?
View 1 Replies
Feb 1, 2011
what is best to use in CTP 5 for inheritence. Ive heard of 3 ways of doing it. (This is indirectly addressed to Serenarules )
Table per Hierarchy ?
Table per Type ?
or able per Concrete Type ?
For those who wondering what the hell is that.. refer to http://weblogs.asp.net/manavi/default.aspx which is a nice blog about inheritence and polymorphism in CTP 5.
View 5 Replies
Jul 16, 2010
All my controllers inherit from a BaseController that has an ActionFilter attribute:
[AnalyticsData]
public class BaseController : Controller {}
public class AccountController : BaseController {}
Some of my Actions in my controllers reuse the AnalyticsData ActionFilter:
public class AccountController : BaseController
{
[AnalyticsData(Page="AccountProfile")]
public ActionResult Profile()
{
// return View
}
}
I notice that the AnalyticsData ActionFilter only runs once. This is a good thing and I only want it to run once, but I'm wondering how that happens. If I set my breakpoint inside the OnActionExecuting:
public class AnalyticsAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
// break point set here
}
}
only gets hit once when AccountController serves it Profile view. How do ActionFilters and/or Attributes work that [AnalyticsData(Page="AccountProfile")] on the Action overrides/replaces [AnalyticsData] on BaseController?
View 1 Replies
Apr 20, 2010
how do I understand web service software factory with concrete examples? Is it wcf oriented?
View 4 Replies
Aug 27, 2010
Retrieving the COM class factory for component with CLSID
{11BD5260-15B6-412D-80DB-12BB60B8FE50} failed due to the following error: 80070005. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {11BD5260-15B6-412D-80DB-12BB60B8FE50} failed due to the following error: 80070005.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
View 3 Replies
Feb 15, 2011
[Code]....
While trying execute the above code in server, I am getting COM class factory error, as mentioned below
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {91493441-5A91-11CF-8700-00AA0060263B} failed due to the following error: 80040154.
My system configuration is Windows Server 2008 64bit. The solution for this issue is mentioned in [URL] As part of solution mention in above link, I cannot find the Microsoft Excel Application in the DCOM Config item. Does anyone know how to fix this issue? Or is there any alternative approach to fix this?
View 6 Replies
Jun 23, 2010
My Crystal Reports works perfectly when I have it on my local host, once I upload it to the server I get the error listed below. I ran the following MSI on the dedicated server: CRRedist2008_x86.msi.. If it is a permission issue, I am using Plesk Panel so there is no ASPNET user, it is different users, what user and what specific folder do I have to give permissions to? Retrieving the COM class factory for component with CLSID {5FF57840-5172-4482-9CA3-541C7878AE0F} failed due to the following error: 80070005.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.UnauthorizedAccessException: Retrieving the COM class factory for component with CLSID {5FF57840-5172-4482-9CA3-541C7878AE0F} failed due to the following error: 80070005.
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user. To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
View 3 Replies
Aug 15, 2010
When people talk about extending a control are they just talking about inheritance?
View 1 Replies
Feb 6, 2010
Can anybody tell me why multiple inheritance is not supported in C#?
View 9 Replies
Mar 1, 2010
I'm trying to figure out if its possible to have multiple inheritance in a view in ASP.Net MVC. Right now I'm trying to print out a list of entries from two different tables from my model in a single View. I have the following line at the top of my view:
Inherits="System.Web.Mvc.ViewPage<List<GEApproval.Models.CoursePrefix>>"
But I also want to include the table Course as follows:
Inherits="System.Web.Mvc.ViewPage<List<GEApproval.Models.Course>>"
I went ahead and created a composite class as follows:
namespace GEApproval.Models
{
public class Listings: GEApproval.Models.CoursePrefix, GEApproval.Models.ICourse
{
public List<CoursePrefix> CoursePrefixObjList { get; set; }
public List<Course> CourseObjList { get; set; }
private GEApprovalDataModel _db;
//Constructor
public Listings()
{
_db = new GEApprovalDataModel();
}
//Generate a list of all courses associated with the prefix and place in ViewData model
public void listCourses(ViewDataDictionary viewData, int prefixID)
{
var test = _db.CoursePrefix.Include("Course").First(cp => cp.id == 1);
//Show total courses for this prefix
viewData.Model = test.Course.ToList();
viewData["prefix"] = test.Prefix;
viewData["courseCount"] = test.Course.Count;
int courseCount = test.Course.Count();//Test
}
}
}
And in my view, I now have the following line:
Inherits="System.Web.Mvc.ViewPage<List<GEApproval.Models.Listings>>"
I'm still a little confused because I still cannot access the properties of the Course object when listing them in my view, because I'm only inheriting directly from CoursePrefix. I'm not sure what I'm missing. Do I need to have a constructor for the composite object? Do I need the inherit and implementation statements for CoursePrefix and ICourse respectively if I'm already, supposedly, exposing the properties of each within the Listings wrapper class?
View 5 Replies
Mar 10, 2011
I work in a web agency and thus we are plenty of websites from several customers. They're built upon a cms we made, so websites are quite identical for the 90% of code. However, remaining 10% struggles me and my team as it involves not only the presentation layer but behavioral logics too (ex: a website1 requires simply user/pass registration while website2 needs more data, facebook connector, etc. But this is a very easy example). Making ad hoc development for our customers is becoming painful as keep each version aligned is getting really hard for us What I really dream to have is an extendible website that works by itself, but in which I can override a part. This behavior should sound like "look for the specific part, if it doesn't exists get the base one". The parts could be a method, a class, a page, a control, a static file.
example:
Suppose I want website2 to have an own login component, let's so imagine that we have a situation like:
/website_base
|_ login.aspx
/website1
/website2
|_ login.aspx
So, if I ask for [URL] I'll get /website_base/login.aspx, but if I ask for [URL] I'll get /website2/login.aspx
View 3 Replies
Mar 17, 2011
I'm using EF4 to generate a model. My architecture looks like this:
IMyEntity (custom interface)
-> MyEntity - EF generated class
IMyOtherEntity (custom interface)
-> MyExtendedEntity (Customn Partial class) : MyOtherEntity (EF Generated)
The first entity has a list of MyExtendedEntity. Is there any way I can bind this with the entity framework. I'm targetting ASP.NET and WPF. The main probnlem I have is that I need an ObservableCollection in WPF, while the EF generated class only has an EntityCollection which doesn't even seem to derive from ObservableCollection.
View 1 Replies
Oct 25, 2010
Am new bee to Webservices.I have declared complete BLL in the class library.
Can call those methods defined in Class library class files(.cs file) in .asmx file.
View 3 Replies
Feb 9, 2011
I am using Excel interop (Excel 2003) for excel import and export in my asp.net(2.0) application. When i deploy it in the server and when i try to import, i am getting the following error Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 8000401a
View 1 Replies
Jul 6, 2010
I am facing below error
"Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005."
"at WebApplication1._Default.GenerateExcel(String xmlString) in E:\TestWebApp\WebApplication1\WebApplication1\Default.aspx.cs:line 110
at WebApplication1._Default.Page_Load(Object sender, EventArgs e) in E:\TestWebApp\WebApplication1\WebApplication1\Default.aspx.cs:line 30
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)"
View 1 Replies