nullable

How does one do a null check for a Guid in xslt?

I am trying to edit an xslt file. One line reads: <xsl:if test="number(./@LatestAuthor) &gt; 0"> The issue I have is that latest author used to be of type int and is now a nullable Guid. How can I edit the xslt file to check if @LatestAuthor is not null? Thanks. ...

Setting LLBLGen Pro TypedList Properties to Nullable type?

I am using LLBLGen Pro 2.6. In the designer, you can easily set a field in an entity to be a .Net nullable type. When you have those same fields in a Typed List, there doesn't seem to be a way to set that same field to be a .Net nullable type. Is anyone aware if and how to do that? Thanks! ...

.net: How to execute a stored procedure with a nullable parameter in c#?

How to execute a stored procedure with a nullable parameter in c#? EDIT: Actually, I've written below code. As you can see, status parameter is a nullable value type. Is it correct? or not? public void LoadAll(DataTable tb, int? status=null) { try { using (SqlConnection connection = new SqlConnection()...

How do I insert the null value in a Boolean attribute when using Hibernate?

I have a class with a Boolean attribute. When I instantiate and persist this class, the Boolean attribute is stored with the "false" value instead of the expectable "null". How can I set a Boolean attribute to "Null"? ...

Varchar columns: Nullable or not.

The database development standards in our organization state the varchar fields should not allow null values. They should have a default value of an empty string (""). I know this makes querying and concatenation easier, but today, one of my coworkers questioned me about why that standard only existed for varchar types an not other dat...

MVC map to nullable bool in model

With a view model containing the field: public bool? IsDefault { get; set; } I get an error when trying to map in the view: <%= Html.CheckBoxFor(model => model.IsDefault) %> Cannot implicitly convert type 'bool?' to 'bool'. An explicit conversion exists (are you missing a cast?) I've tried casting, and using .Value and neither wor...

Nullable class?

I have this class public class FilterQuery { public FilterQuery() { } public string OrderBy { set; get; } public string OrderType { set; get; } public int? Page { set; get; } public int ResultNumber { set; get; } } I would like to use it like this public IQueryable<Listing> ...

Enterprise Library Validation Block: Validating a nullable datetime

Hi, I'm trying to validate a nullable datetime using the Enterprise Library Validation Block without success. I've got a WinForm with a DateTimePicker with a visible checkbox. The DateTimePicker is bound to a nullable DateTime prooperty using a custom databinding where the parsing is done like this (if the DateTimePicker is not checked...

Are nullable types reference types?

when I declare an int as nullable int? i=null; Is i here become a reference type? ...

are C# int? and bool?s always boxed when hasvalue = true?

This MSDN reference seems to indicate that when an int? (or any Nullable<T>) has a value, it's always boxed (and hence a much less efficient store of data, memory-wise than an int). Is that the case? ...

Is a c# WebService with nullabele int BasicProfile 1.1 conform

Hi! I want to implement a WebService that should be BasicProfile 1.1 conform. The WebMethod should be something like this: byte[] Test(int? count) Is this call BasicProfile 1.1 conform? How can I check BasicProfile 1.1 conformability? ...

NULL Guid in Soap/xml call

I am developing applications that communicate to a web service to access a database. One of the web service calls returns data held by a node in a tree structure by taking either the GUID of the node, or NULL to return the root node. Adding a web service reference to a managed project easily allows null to be sent as a parameter, but ...

C# using LINQ and Nullable Boolean

I have the below linq query which takes a text field which may be Y, N or DBnull and populates a boolean? parameter with either True, False or null depending on the value of the field. var dset = from i in tbdc.Talkbacks where i.talkback_id == id select new Talkback(i.talkback_id, i.acad...

Dynamically adding Where parameters to LinqDataSource on nullable column

I am dynamically adding a where parameter to a LinqDataSource that binds a GridView. Parameter p1 = new Parameter { Name = "Param1", Type = TypeCode.DateTime, DefaultValue = DateTime.Now.ToShortDateString() } ; MyLinqDataSource.WhereParameters.Add(p1); MyLinqDataSource.Where = "EndDate >= @Param1"; This works, but ...

c# .net 4.0 : nullable input string parameter and the lambda expressions.

I have a following method: public IQueryable<Profile> FindAllProfiles(string CountryFrom, string CountryLoc) { return db.Profiles.Where(p => p.CountryFrom.CountryName.Equals(CountryFrom,StringComparison.OrdinalIgnoreCase)); } Right now, it just filters by CountryFrom but I need to filter it by CountryLoc as well. So how do I m...

Is there any way to constrain a type parameter to EITHER a reference type OR a nullable value type?

It'd be nice if I could define a method like this: public T GetItem<T>() where T : null { if (someCondition<T>()) return someCalculation<T>(); else return null; } Then I could use this on reference types (e.g., object, string) as well as nullable value types (e.g., int?, double?): anything that can be assigned ...

Looking for a more elegant way to check for nullable value types.

To check if a value type is nullable I'm currently doing something like this: int? i = null; bool isNullable = i.GetType().ToString().Contains("System.Nullable"); Is there a more elegant way to do this? ...

Error in assigning object of nullable type in vb.net

Hi, I am new to VB.net and facing a strange situation. I have a structure that contains another structure. The inner structure is nullable. Now wht I do is something like the following. I create a new instance of the inner structure, set the member variables and assign the whole structure to the inner structure of the parent. But it is g...

Hiberate / JPA -> Nullable values & objects?

Hi My basic question is: How can I force Hibernate to make float NULLable and accept NULL for float, datetime, blob, respectively? I really mean NULL, not (float) 0.0. Even worse, when I try to store an object with the desired NULLable fields actually being NULL and using entity manager, I get errors for attributes, which are marked as...

XmlSerializer and nullable attributes

I have a class with numerous Nullable<T> properties which I want to be serializable to XML as attributes. This is apparently a no-no as they are considered 'complex types'. So, instead I implement the *Specified pattern, where I create an addition *Value and *Specified property as follows: [XmlIgnore] public int? Age { get { return...