score:6
Accepted answer
did you try set allowtruncation=true
for your properities in city
class?
public class city
{
[bsonid]
[bsonrepresentation(bsontype.int, allowtruncation=true)]
public string id { get; set; }
[bsonrepresentation(bsontype.int, allowtruncation=true)]
public int value { get; set; }
}
how do i set the serialization options for the geo values using the official 10gen c# driver?
score:7
you typically don't want your model to know or care how it's being stored, so peppering it with mongodb.bson
attributes is not ideal. you can configure how mongodb.driver should read and store decimals with this config instead.
bsonserializer.registerserializer(
typeof(decimal),
new decimalserializer(bsontype.double,
new representationconverter(
true, // allow overflow, return decimal.minvalue or decimal.maxvalue instead
true //allow truncation
))
);
Source: stackoverflow.com
Related Query
- mongodb data losing when run web service in c#
- OData WCF Data Services - Related data (by foreign key) doesn't show up when calling the service
- How to mock a 3rd party web service LINQ data provider?
- WP7 Getting and storing data from an xml web service for use across the project
- WP7 Return the last 7 days of data from an xml web service
- Web service is working but data not shown in textbox
- DataContext not visible when choosing data source for LinqDataSource
- Exception when changing data source to SQL
- c# Linq or code to extract groups from a single list of source data
- How to run a function when querying a data entity using Entity Framework?
- How do I find the text within a div in the source of a web page using C#
- Purpose of EF 6.x DbContext Generator option when adding a new data item in Visual Studio
- Entity-framework code is slow when using Include() many times
- The data source does not support server-side data paging
- When should I dispose of a data context
- Web API OData media type formatter when using $expand
- How can I use Nhibernate to retrieve data when the "WHERE IN()" have thousands of values? (too many parameters in the sql)
- I am wondering about the state of connection and impact on code performance by 'yield' while iterating over data reader object
- LINQ to SQL does not update when data has changed in database
- Forcing XDocument.ToString() to include the closing tag when there is no data
- Duplicate Rows when Data Binding with LINQ to Entities
- System.ArgumentException: Complex DataBinding accepts as a data source either an IList or an IListSource
- Why does sp_executesql run slower when parameters are passed as arguments
- LINQ to SQL - Compile error when extending data context with partial class and methods
- Why is my WCF Data Service not able to serve an automatically generated ADO.Net EDM?
- Is there any way to create a LINQ query as a variable without having the data source (yet)?
- How to reuse a linq expression for 'Where' when using multiple source tables
- Best way to write DataTables from a Web Service into XML?
- Avoiding code repetition when using LINQ
- Return Count from Netflix oData Service When the LINQ Count() Method Doesn't Work
More Query from same tag
- The relationship between the two objects cannot be defined because they are attached to different ObjectContext objects mvc 2
- Convert SQL subquery in Linq
- Entity Framework Code First - The entity or complex type cannot be constructed in a LINQ to Entities query
- JOIN and LEFT JOIN equivalent in LINQ with Method Syntax
- Faster way to filter a list of objects in to another list based on a condition
- Implement a "join" with a variety of tables in Entity Framework
- Create null enumerable within Linq to Entities query
- Extension methods not showing even on implementing IEnumerable
- Linq between class of table database and List<T>
- Enable RemoveRange to remove by predicate on entity
- Get previous value in linq loop?
- Null check String.ToLower in Linq Where expression
- NHibernate 3.0 and LINQ: what am I missing?
- Is it possible to do this.Sort(p => p.ID); or something similar?
- Fetch value from database table where one column of table(foreign key) is equal to input value
- Linq - group a list into pairs based on a property
- Why is RemoveAll(x => x.Condition) removing all my records?
- Convert SQL query to LINQ query not working
- Write Aggregate as Sql Syntax
- Error null reference in left join
- Sort C# map with value and key
- LINQ to Object Basic
- How to compare with a string array and string
- Multi sums into one anonymous type with linq?
- How to remove the XML declaration when using LINQ to XML?
- Using Linq (nHibernate) to perform a Case statement with Counts
- Error: DbContext has been disposed
- linq left join with where clause show all from left table regardless
- CopyToDataTable in LINQ
- C# LINQ Add to list every regex value group