.net

What is the impact of lazy="false" on class element of NHibernate mapping?

I'm working with a legacy system that I'm experimenting with adding NHibernate to. I have class that I need to be mapped to a table, but it has lots of existing methods that are not virtual. I discovered that I can get NHibernate to load the mapping successfully even with the non-virtual methods present if I set the "lazy" attribute on...

Why isn't my .net destructor called in this very simple scenario?

I've got the following code : public class A { ~A() { Console.WriteLine("destructor"); } } public static A Aref; static void Main(string[] args) { Aref = new A(); int gen = GC.GetGeneration(Aref); Aref = null; GC.Collect(gen, GCCollectionMode.Forced); ...

Does .NET have anything like PropertySet/EntityEngine design?

Hi, Does .net have any propertyset design/architecture? something like: http://www.opensymphony.com/propertyset/usage.jsp Or specifically: http://ofbiz.apache.org/docs/entity.html Is this how the entity framework is or is that different? Does it have an expernal .xml file that has mapping info? ...

How do I find a subset of items in two sets of data that partially differ?

I am trying to get the subset of items in dataA that are in dataB, and have different values of property c. The properties a and b can be used as an index, so I have tried to filter out only the useful pairs then check to see if they have a different c value. This is the linq expression I came up with, and it does work, but It seems li...

is it legal to recreate a rooted reference to 'this' in a .net destructor ?

Is it legal to write the following in .net ? public class A { public int i = 0; ~A() { Aref = this; } } public static A Aref; static void Main(string[] args) { Aref = new A(); int gen = GC.GetGeneration(Aref); Aref = null; GC.Collect(gen...

Is there a JavaBlackBelt equivalent for .Net?

I used to use JavaBlackBelt a lot when I was first learning java, I have now switched to .Net and I was wondering if there was an equivalent site? ...

Mapping collection of strings with NHibernate

Hi, I have a domain class with a property IList<string> that I want to map to a table with a single data value (i.e. it has an ID, a foreign key ID to the domain entity table, and a varchar data column). I keep getting the error: 'Association references unmapped class: System.String'. How can I map a table to a collection of strings? ...

Help needed for 'cross-thread operation error' in C#.

In the following code MessageReceived is on a different thread to label1 and when trying to access it I will get this error: Cross-thread operation not valid: Control 'label1' accessed from a thread other than the thread it was created on. foo.MessageReceived += new Agent.MessageReceivedHandler(foo_MessageReceived); void fo...

Using Enum for a data layer object's 'status' in C#

I have a data object (let's say it's called 'Entry') that has a set of potential states that look something like this: 1 - Created 2 - File added 3 - Approved 4 - Invalid This is represented in the database with a 'Status' table with an autonumber primary key, then a 'StatusId' field in the main table, with the appropriate relationship...

Link to table showing CultureInfo for ALL cultures

I'm losing my mind trying to find a table showing all the formats of datetimes for cultures I've been googling like crazy and all i want is that table! ARG i.e. en-CA = DD/MM/YYYY 0.00 en-FR = MM/DD/YYYY 0,00 I'm looking for a link to MSDN or wikipedia - I know I've seen this in the past before ...

How do I find an XML element by attribute using LINQ to XML?

I'm learning LINQ to XML and need to find the existence of an element with a particular attribute. At the moment I'm using: XElement groupCollectionXml = XElement.Parse(groupCollection.Xml); IEnumerable<XElement> groupFind = from vw in groupCollectionXml.Elements("Group") where (string) vw.Attribute("Name") == groupName sele...

Inject custom type conversion to .NET library classes

I would like to implement conversion between two library classes by Convert.ChangeType in C#. I can change neither of the two types. For example converting between Guid and byte[]. Guid g = new Guid(); object o1 = g; byte[] b = (byte[]) Convert.ChangeType(o1, typeof(byte[])); // throws exception I am aware that Guid provides a ToByteA...

Which controls have ViewState maintained?

I am trying to wrap my head around the control infrastructure to understand which ones ASP.NET maintains view state for. There are these regular HTML controls ex: <input type="radio" checked="checked"/> -> I understand these do not have viewstate Then there are HTML controls with runat="server" <input type="radio" checked="checked" run...

Odd .Net Could Not Load Assembly Error

I have a super basic form that shoots out an email. The code is contained within a virtual directory like http://url/emailer/emailer.aspx on a new server and is working fine. We are in the process of migrating a few additional sites over to this new server. To test, I'm accessing the files via the ip address so I can see the site on the...

Can a windows hosted WCF service use HTTPS?

I have a WCF service that is using webHttpBinding on an endpoint, and the WCF service is hosted as a windows service. Is it possible to secure this at the transport level by using HTTPS or some other method? ...

Setting a checkbox by using <%# isChecked %> expression

Here is a simplified example of what I am trying to achieve; <asp:CheckBox runat="server" Checked="<%# this.isChecked %>" id="myCheckBox" /> Then in my code behind; public partial class _Default : System.Web.UI.Page { bool _isChecked = true; public string isChecked { get { return _isChecked.ToString(); ...

linq Order By for a List(Of myObjects)

How do I order by a passed string value on my list of objects? i need to do paging and sorting on my List(Of) objects the paging is no problem but I don;t know who to get the Order By to work. Here is what I am currently doing and it's working great: Return returnReports.Skip(PageSize * (PageNumber-1)).Take(PageSize).ToList() How do ...

Open source MPG to FLV Converter?

Anyone know or use an open source MPG to FLV converter that I would be able to use programatically? Preferably .NET . If you know any .NET commercial ones also then I would be grateful of those links too. Cheers, Andrew ...

What is the opposite of Type.MakeByRefType

The Type.MakeByRefType method in .NET returns a by-ref version of a type, e.g. passing the type of System.Int32 returns a type representing System.Int32&. However, if you already have a System.Int32&, what is the mechanism for obtaining a plain old System.Int32? There doesn't seem to be an opposite method to remove the by-ref modifier. ...

How can I bind certain properties belonging to a custom control?

If I have the following control: public partial class MyControl : UserControl{ public string MyControlText{ get { return MyTextBox.Text; } set { MyTextBox.Text = value; } } public MyControl(){ ... } } How can I bind to the "MyControlText" property when I place the control on one of my pages, like so: <lo...