StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Mapper BehaviorExpand / Collapse
Author
Message
Posted 05/07/2006 5:27:56 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 05/25/2007 3:34:57 PM
Posts: 235, Visits: 309
I just did a rebuild of a bo and the partial class after the rebuild had a blank namespace instead of what had been there before.

Also, I was doing this to get rid of the dreaded NULL error message when there is a null field in the result set. The default behavior of this is really less than useful - in fact it is a pain in the butt. So I thought that I would change the fields in the mapper to nullable generic. Having done so I get code like this:
public Nullable MIDDLENAME
{
get
{
object loValue;
loValue = this.CurrentRow["MIDDLENAME"];
if (loValue == DBNull.Value)
{
return (Nullable)null;
}
else
{
return (Nullable)loValue;
}
}
set
{
if (value.HasValue)
{
this.CurrentRow["MIDDLENAME"] = value.Value;
}
else
{
this.CurrentRow["MIDDLENAME"] = DBNull.Value;
}
}
}

And the following error message when I try to compile:
The type 'string' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method 'System.Nullable'

What now?
Post #1113
Posted 05/08/2006 8:19:27 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/09/2008 3:36:08 PM
Posts: 2,686, Visits: 1,891
You cannot use a nullable generic data type with a string because the System.String type is not a value type but a reference type.  You can only use the System.Nullable<T> type with value types (int, float, boolean, structures, etc.).  So, with string values, you will need to configure the fields to return an alternate value on NULL.  Generally, you would configure the string field to return either string.Empty or 'null' when a DBNull.Value value is returned.


www.bungie.net
Post #1120
Posted 05/08/2006 7:08:20 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 05/25/2007 3:34:57 PM
Posts: 235, Visits: 309
Since I mostly use string fields, and most allow nulls, it is ALOT of work to manually set each one to return "" on dbNull. Isn't there some way to set a default or apply the same setting to all string fields in a table and then change the 1 or 2 that require different handling?

CSLA has a "smart string" and "smart date" that do this automatically. When a dbNull occurs, the string automatically returns string.Empty and the date can return either string.Empty, a min or a max value depending on a config flag.
Post #1141
Posted 05/09/2006 8:39:46 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/09/2008 3:36:08 PM
Posts: 2,686, Visits: 1,891
Yes, I just completed the Customization Wizard for the BOMapper that allows you to select 1 or more fields (up to all fields on all business objects) and apply the settings to all of them at the same time.  I'm not sure when we'll be putting together the beta install for the next version, but I might be able to get you the DLLs.  You would have to replace all of them because there have been some major changes to the references (to remove the pesky warning about different versions of the same assembly, 1-click deployment problems, etc.).


www.bungie.net
Post #1150
Posted 05/09/2006 12:00:43 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: Forum Members
Last Login: 05/25/2007 3:34:57 PM
Posts: 235, Visits: 309
great!
Post #1164
Posted 05/09/2006 1:44:48 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 12/09/2008 3:36:08 PM
Posts: 2,686, Visits: 1,891
Looks like we'll be releasing this next week along with the DevExpress wrapper dll, so stay tuned.


www.bungie.net
Post #1170
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 8:34am

Powered by InstantForum.NET v4.1.4 © 2009
Execution: 0.125. 13 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.