Extending The LoggingFacility In Castle Windsor?
Oct 31, 2011
I'm currently using the log4net portion of the Castle Windsor logging facility, like so:
objContainer.AddFacility("logging", New LoggingFacility(LoggerImplementation.Log4net)WithConfig("ConfigsLog4net.config"))
I need to pass in a couple of variables to the logger because I am using dynamic log file names. I have looked at the source code and determined that one possible course of action is to create a custom factory and facility but this is alot of work and I'm not sure it is best practice.
View 1 Replies
ADVERTISEMENT
Nov 18, 2011
I'm having an issue with Castle Windsor 3 Beta 1. I'm using the ArrayResolver which has been added to the installer like so:objContainer.Kernel.Resolver.AddSubResolver(New ArrayResolver(objContainer.Kernel, True))
From there I am registering a component and trying to inject an array of IWorkers. The IWorkers have their own dependencies. In the case where only one IWorker is specified, its dependencies are resolved- but when multiple are passed in this does not happen.
This won't work:objContainer.Register(Component.For(Of Services.INotifiableService).ImplementedBy(Of Services.MyService).Named(GetType(Services.MyService).Name).DependsOn(Dependency.OnComponent(GetType(Services.Resolvers.IResolver), GetType(Services.Resolvers.MyResolver).Name), Dependency.OnComponentCollection(Of Services.Workers.IWorker())(GetType(Services.Workers.IWorkerImplementationA),
[Code]...
View 1 Replies
Aug 5, 2010
I'm trying to implement the Bouncy Castle encryption library in a .Net project, but am not finding a lot of .Net-related documentation. The class/method structure isn't even close to the ample Java-related examples.
View 2 Replies
Jul 27, 2010
When user inserts a duplicate entry in a unique field, Castle ActiveRecord throws the following exception:
Castle.ActiveRecord.Framework.ActiveRecordException was unhandled
Message="Could not perform Save for SerieNotaFiscal"
Source="Castle.ActiveRecord"
StackTrace:
[Code] .....
View 1 Replies
Mar 5, 2010
When you create a webpage in ASP.net, the codebase inherits System.Web.UI.Page Now when I extend the page object to check for SessionExpired for example, I create a new class and inherit from system.web.ui.page, and overwrite some functions. The problem then is that on each page, I have to replace system.web.ui.page with my custompage class. Is there a way to extend a class by adding methods or modifying its methods directly (e.g. add the sessionExpired check to System.Web.UI.Page) ?I'm using .NET 2.0
View 2 Replies
Mar 17, 2011
I have a class within a library, with no root namespace, firstone.dll:
namespace first
public partial class one
public sub fun()
[Code]....
Is there a way to extend the class in a separate dll and still have access to the original class? I don't want to inherit the class just extend it.
View 3 Replies
Jun 27, 2011
I know from .NET 3.5 onwards (or might be 3.0) we can use Exension Methods to add our own methods to any Type in the .NET Framework and this is very handy, but I'm wondering if it is possible to "extend" an Enum as well?
View 13 Replies
Aug 19, 2011
I would like to create a DataGridView that displays records that fill either 18 or 35 columns. I would like to avoid displaying all 35 columns for all records, instead showing the 17 extra columns on a second row for records that need them.How would I go about this? I'm guessing I need to create a new class that inherits from DataGridViewRow and override it's Paint or PaintCells method, but I have no experience with overriding Paint events, so I'm kind of lost after that.
View 8 Replies
Jul 28, 2011
I need to add functionality to my web service calls so object translation and automatic retries are done and abstracted away.I would usually override the base class to add the extra functionality, but as the proxy methods aren't over-ridable I can't keep the method names the same. The only other option I can think of to do it this way is to use the 'Shadows' keyword to achieve what I want.What other methods do people use to add functionality to their web service proxy classes without modifying the generated classes?
View 1 Replies
Jul 30, 2009
I have an class named Foo. This class contains a collection of child objects of type FooChildBase, but I also have a further class of type FooChildTwo which inherits from FooChildBase.
Class Foo
Public Children As IList(Of FooChildBase)
End Class
Class FooChildBase
[code]....
What I would like to do is have my FooSpecial Class treat it's Children collection as if they were FooChildSpecial objects, but still be able to add FooChildTwo objects to it. Is this possible and if so how can it be done?
EDIT:I need to FooChildSpecial class to wrap any of the objects in the Children collection with the extra values, whether they are FooChildBase or FooChildTwo?
View 3 Replies
Jan 11, 2010
I am wondering if I can extend a component (e.g a button ) in vb the same way I can in java which enables you to modify the component for your specific requirement or create a new one from scratch.
View 3 Replies
Feb 26, 2011
I've been wondering if there is anyway to extend a sub of a base class in a derived class or subclass. To date, the only thing I've been able to find is overrides and overloads functions, but to my understanding these functions just ignore your base class's sub and just allows you to run the new one with the same name.
What I want to be able to do is:
CODE:
I'm not sure whether this is possible, or if I'd simply either make a new sub in my derived class that first ran the base's class sub or whether I'd override the base class and then copy and paste the old code.
View 6 Replies
Apr 1, 2010
Briefly, what I'm trying to do is add some methods and properties to the FileInfo class, which is sealed (NotInheritable). As far as I can tell, I have two options to do this.
1) Inherit from FileSystemInfo (the base class for FileInfo) and recreate the methods and properties added by FileInfo (essentially recreating the FileInfo class from scratch)
2) Use extension methods (??) which I just learned about two minutes ago and it being 1am, I'm going to get into this tomorrow
3) Create a wrapper class around a FileInfo object - I think that's the proper term
Ok, so I guess there are 3 options.
A) Why make a class uninheritable
B) Is creating a wrapper class "basically" the same as inheriting from an object, but at least with inheritence you don't need to create any properties and methods other than those you want to modify or add?
Am I correct when I say that a Field is a protected property that can only be accessed by the base class and inherited classes, or is the definition of a field something else?
View 2 Replies
Nov 5, 2010
Is it possible to add a property to the existing asp:BoundField control without creating a brand new instance to which I'd have to declare <tst:BoundField></tst:BoundField>?
View 1 Replies
Jan 4, 2010
I have a base class which needs to define an enumeration:
BaseClass
- SomeEnum
I then need to create two derived classes from the base class and extend the values in the enumeration:
ChildClass1 : BaseClass
- SomeEnum
- SomeEnumValue1
[code]....
In C# or VB.NET can someone provide the syntax to do this?
View 3 Replies
Nov 2, 2009
is there anyway we could extend a shared function for a class? example:
<Extension()> Public Shared Function GetName(ByRef e As [Enum], ByVal value As Object) As String
Return [Enum].GetName(e.GetType, value)
[Code].....
however i dun hav a choice as Extension methods can be declared only within modules
View 21 Replies
Nov 26, 2010
As the default for visual studio 2010 is set to ".NET Framework 4 Client Profile" and as such that ill be whats available on the clients PCs. So as i'm looking at adding data binding to a listview headercolumns, i was planning on extending the CollectionEditor (if i have to), but the CollectionEditor is only available when you target the full .NET Framework. So therefore i need to create a second solution with that as a target and build my extended CollectionEditor, but how do i get Studio 2010 (not my 'client' project) to reference my extended CollectionEditor?
View 10 Replies
Jan 27, 2010
imagine i want to add an extension method to System.Collections.Generic.List(Of T)
let's say i want to give it .GetUBound which returns Count-1
View 7 Replies
Oct 11, 2010
I have to create an XML database for a class I'm taking, but I'm running into some problems. I'm trying to pack my data directly into the DOM using some classes I created and derived from the XMLDocument class, I'm trying to do it this way so I can easily manipulate the entries while the document is in memory and save them back to a file without having to mess around too deeply with the XMLDocument class. I'm running into some problems however when I try to typecast the elements I get from calling
Code:
XMLDocument.DocumentElement.Item
I assume that this is happening due to my derived class not being pushed into the DOM when a file is loaded, because it works just fine if I enter the data manually in code.
Code:
Option Explicit On
[CODE].............
Other than writing my own XMLReader I have no idea how to accomplish this, does anyone have an idea how I could go around doing this(other than writing my own XMLReader).
View 3 Replies
Jan 13, 2012
I have a program built on VB.NET and C# . It calls Win32 API and another APIs we made and others (WodSSH and DevExpress).Now we plan to extend our tool to run on Linux and UNIX GUI for UNIX end-users. We have doubts whether to try to import the program somehow (I heard about Mono and Wine) or build it from scratch in Java.
View 6 Replies
Jun 14, 2010
If I defined a ENUM in a base object with serveral default values. When I inherit from the base object I want to add more options the the ENUM list which are specific to the inheriting object.
For example my base could have a ENUM called Direction with values:
None
ALL
Stop
Start
I create a new class call Compass which inherits the base class and what to add the following to the ENUM Direction. I create a new class call Navigation which inherits the base class and what to add the following to the ENUM Direction. So, In my inheriting class haow do I extend the ENUM.
View 1 Replies
Jun 18, 2010
So in a lot of frameworks there is usually some base type that you tend to extend a lot because well, it is what enables the "visual" aspect of the framework. Here in .Net it's the Control/Form... you tend to be inheriting these frequently for different things, and despite the suggestions otherwise, the team always agrees to extend explicitly and forget about composition.So now say you want to create some relationship between all of these... just a simple interface that uncovers some basic properties that all your forms and controls should have. In this case lets call it 'IProjControl'
Code:
Public Interface IProjControl
Property ProjControlId() As String
[code]....
So this interface is something you expect all your windows and dialog boxes and other some other controls implement. They all don't extend the same exact type, they all just happen to be controls.In there lies the problem... you want to enforce the contract with this interface that not only is it a 'IProjControl', but it's also a 'Control'. But we can't exactly have our interface extend Control (that doesn't make sense), and there isn't an 'IControl' interface to require implementing.
So the method I've always used is something like this:
Code:
Public Interface IProjControl
ReadOnly Property ProjControlComponent() As Control
Property ProjControlId() As String
[code]....
(if there is actually a language/compiler specific feature that allows you to require an interface implementation to be implemented by a class extending a specific type... please, do tell... but I highly doubt there is because for all intensive purposes that sounds weird).
View 12 Replies
Nov 11, 2010
I defined the following extension of the Date? data type
[Code]...
But when I moved my compiler definition to a separate DLL, I the ToObject method was no longer available from my project even though I had referenced the Class project which now contained the extension. Is this a limitation of the Compiler Extensions? HOw do you get reusability out of them?
View 1 Replies
Feb 10, 2012
I would like to add a property to the BoundField control that will change rendering as show below.
<td>My Bound Text></td>
Should become
<td><span>My Bound Text</span></td>
This is all I have so far...
Public Class BoundField
Inherits System.Web.UI.WebControls.BoundField
Dim _ellipse As Boolean[code]....
I have the same problem as this poster, however I am using a .net gridview and would like render my html to use the fix offered here.Using CSS to create table cells of a specific width with no word wrapping. EDIT I think I may be going about this all wrong, maybe you don't change the rendering by extending the BoundField, but rather add the properties to the boundfield then change the way the gridview renders its fields based on the properties of those fields.Which also leads me down the path of control adapters,
View 1 Replies
Sep 29, 2011
This is the following. Normally, when i have a city, i'm using some javascript to autocomplete the cities as the user type. Now i want it to make it automaticly, using the edittemplate. So i would change :
[Code]...
View 2 Replies
Jul 27, 2009
If I'm extending OnCreated for a LINQ to SQL table object, is it possible to get a reference to the data context to which the table belongs? For example, if I add a property to the data context:
Partial Class MyDataContext
Private _myValue As String
Public ReadOnly Property MyValue As String
[Code].....
I don't want the property on the data context to be Shared, because it could be different per instance. I've been pouring over the designer code to figure out where the reference might be, but no luck yet.
View 3 Replies
Jan 15, 2010
i was trying to inherit System.Type. this is what i have:
[Code]...
and anyway the real problem is that inheriting System.Type without declaring my derived class as 'MustInherit
View 9 Replies