We have released a new version of DataObjects.Net
In the version following changes were performed:
[main] Fixed certain scenarios when In() or Contains() operations in query led to NullReferenceExecption exception
[main] Persist operation no longer breaks enumeration of EntitySet items.
Detailed explanation of these changes is in the post.
As usual you can get it from our website or install from Nuget library.
[TestFixture]
public class ContainsTest
{
// ...
// some other members
// ...
private static int StaticItemId = 1;
private int InstanceItemId = 1;
[Test]
public void MainTest()
{
using (var domain = Domain.Build(GetDomainConfiguration())
using (var session = domain.OpenSession())
using (var trasnaction = session.OpenTransaction()) {
var ids = new[] {1, 2};
// works fine
var count = session.Query.All<TestEntity>()
.Count(e => ids.Contains(InstanceItemId)));
// used to be a problem
var count = session.Query.All<TestEntity>()
.Count(e => ids.Contains(StaticItemId)));
}
}
}
Now both cases work fine.
using (var domain = Domain.Build(GetDomainConfiguration())
using (var session = domain.OpenSession())
using (var transaction = session.OpenTransaction()) {
//get order with some items
var order = session.Query.All<Order>().First();
// locally added item
order.Items.Add(new OrderItem());
foreach (var orderItems in order.Items) {
// there are no changes to the collection performed
// forces local changes to be saved to storage explicitly
session.SaveChanges();
}
}
And an example of implicit saving of changes
using (var domain = Domain.Build(GetDomainConfiguration())
using (var session = domain.OpenSession())
using (var transaction = session.OpenTransaction()) {
//get order with some items
var order = session.Query.All<Order>().First();
// locally added item
order.Items.Add(new OrderItem());
foreach (var orderItems in order.Items) {
// there are no changes to the collection performed
// implicit saving
var orderItemCount = session.Query.All<OrderItem>().Count();
}
}
Basically, an EntitySet<T> collection consists of three sets - the first set of items is saved to the database, the second set consists of locally added items and the third one is locally removed items. Two last sets store changes of collection between savings them to the storage. A persist operation (saving changes) merges all the three sets into the first one, which caused an exception during enumeration.
This merge mechanism was changed. Now only user changes can be the cause of enumeration termination. If a user adds or removes something from the EntitySet instance which is being currently enumerated it will break the enumeration. See example below:
using (var domain = Domain.Build(GetDomainConfiguration())
using (var session = domain.OpenSession())
using (var transaction = session.OpenTransaction()) {
//get order with some items
var order = session.Query.All<Order>().First();
// locally added item
order.Items.Add(new OrderItem());
foreach (var orderItems in order.Items) {
//we change contents of the EntitySet
order.Items.Add(new OrderItem());
}
}
Here, the EntitySet<Order> collection was modified during enumeration so it should be terminated.
Another case when user implicitly changes EntitySet is a paired association. For instance, for the model showed below
[HierarchyRoot]
public class Order : Entity
{
[Field, Key]
public long Id { get; private set; }
[Field]
public EntitySet<OrderItem> Items { get; private set; }
// some other fields
public Order(Session session)
: base(session)
{}
}
[HierarchyRoot]
public class OrderItem : Entity
{
[Field, Key]
public long Id { get; private set; }
[Field]
[Association(PairTo = "Items")]
public Order Order { get; set; }
//some other fields
public OrderItem(Session session)
: base(session)
{}
}
Order.Items and OrderItem.Order fields will remain in synchronized state. That cause modification of Items collection and if such thing happens during the collection enumeration an exception will show up. The code below is a great illustration.
using (var domain = Domain.Build(GetDomainConfiguration())
using (var session = Domain.OpenSession())
using (var transaction = session.OpenTransaction()) {
var order = session.Query.All<Order>().First();
var newOrder = new Order();
foreach (var orderItem in order.Items) {
// remove the orderItem from the Items collection
orderItem.Order = newOrder;
}
}
On the first iteration orderItem entity becomes removed from order.Items collection and added to newOrder.Items collection by setting orderItem.Order field. On the second iteration enumerator will detect the order.Items collection is changed and throw an exception.
So now EntitySet enumeration works as it is supposed to and causes no exception unless the collection has been changed by user.
In the version following changes were performed:
[main] Fixed certain scenarios when In() or Contains() operations in query led to NullReferenceExecption exception
[main] Persist operation no longer breaks enumeration of EntitySet items.
Detailed explanation of these changes is in the post.
As usual you can get it from our website or install from Nuget library.
NullReferenceException during query translation
Sometimes inclusion of a static fields in operations like In() or Contains() resulted in the exception. Instance fields are handled correctly though. For example,[TestFixture]
public class ContainsTest
{
// ...
// some other members
// ...
private static int StaticItemId = 1;
private int InstanceItemId = 1;
[Test]
public void MainTest()
{
using (var domain = Domain.Build(GetDomainConfiguration())
using (var session = domain.OpenSession())
using (var trasnaction = session.OpenTransaction()) {
var ids = new[] {1, 2};
// works fine
var count = session.Query.All<TestEntity>()
.Count(e => ids.Contains(InstanceItemId)));
// used to be a problem
var count = session.Query.All<TestEntity>()
.Count(e => ids.Contains(StaticItemId)));
}
}
}
Now both cases work fine.
Persist operation terminates EntitySet items enumeration
Saving local changes to storage while EntitySet<T> collection is being enumerated caused an exception due to the modification of collection. For instance,using (var domain = Domain.Build(GetDomainConfiguration())
using (var session = domain.OpenSession())
using (var transaction = session.OpenTransaction()) {
//get order with some items
var order = session.Query.All<Order>().First();
// locally added item
order.Items.Add(new OrderItem());
foreach (var orderItems in order.Items) {
// there are no changes to the collection performed
// forces local changes to be saved to storage explicitly
session.SaveChanges();
}
}
And an example of implicit saving of changes
using (var domain = Domain.Build(GetDomainConfiguration())
using (var session = domain.OpenSession())
using (var transaction = session.OpenTransaction()) {
//get order with some items
var order = session.Query.All<Order>().First();
// locally added item
order.Items.Add(new OrderItem());
foreach (var orderItems in order.Items) {
// there are no changes to the collection performed
// implicit saving
var orderItemCount = session.Query.All<OrderItem>().Count();
}
}
Basically, an EntitySet<T> collection consists of three sets - the first set of items is saved to the database, the second set consists of locally added items and the third one is locally removed items. Two last sets store changes of collection between savings them to the storage. A persist operation (saving changes) merges all the three sets into the first one, which caused an exception during enumeration.
This merge mechanism was changed. Now only user changes can be the cause of enumeration termination. If a user adds or removes something from the EntitySet instance which is being currently enumerated it will break the enumeration. See example below:
using (var domain = Domain.Build(GetDomainConfiguration())
using (var session = domain.OpenSession())
using (var transaction = session.OpenTransaction()) {
//get order with some items
var order = session.Query.All<Order>().First();
// locally added item
order.Items.Add(new OrderItem());
foreach (var orderItems in order.Items) {
//we change contents of the EntitySet
order.Items.Add(new OrderItem());
}
}
Here, the EntitySet<Order> collection was modified during enumeration so it should be terminated.
Another case when user implicitly changes EntitySet is a paired association. For instance, for the model showed below
[HierarchyRoot]
public class Order : Entity
{
[Field, Key]
public long Id { get; private set; }
[Field]
public EntitySet<OrderItem> Items { get; private set; }
// some other fields
public Order(Session session)
: base(session)
{}
}
[HierarchyRoot]
public class OrderItem : Entity
{
[Field, Key]
public long Id { get; private set; }
[Field]
[Association(PairTo = "Items")]
public Order Order { get; set; }
//some other fields
public OrderItem(Session session)
: base(session)
{}
}
Order.Items and OrderItem.Order fields will remain in synchronized state. That cause modification of Items collection and if such thing happens during the collection enumeration an exception will show up. The code below is a great illustration.
using (var domain = Domain.Build(GetDomainConfiguration())
using (var session = Domain.OpenSession())
using (var transaction = session.OpenTransaction()) {
var order = session.Query.All<Order>().First();
var newOrder = new Order();
foreach (var orderItem in order.Items) {
// remove the orderItem from the Items collection
orderItem.Order = newOrder;
}
}
On the first iteration orderItem entity becomes removed from order.Items collection and added to newOrder.Items collection by setting orderItem.Order field. On the second iteration enumerator will detect the order.Items collection is changed and throw an exception.
So now EntitySet enumeration works as it is supposed to and causes no exception unless the collection has been changed by user.
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThanks for the information you shared, this information is very helpful to me. I will often visit your blog.
ReplyDeleteProship là đơn vị cung cấp tới quý khách hàng dịch vụ vận tải nội địa, dịch vụ chuyển phát nhanh, dịch vụ ship cod, cho thuê xe tải,... uy tín, nhanh chóng và giá rẻ hiện nay tại TPHCM.
Thanks for nice information
DeleteBeta Three was founded in 1988, Beta Three is professional audio manufacturer with R&D and producing;rich technicians and advanced R&D centre and www.stuccorepairlasvegasnv.com/
ReplyDeleteHey, I am Chang. I and my team are providing support for the users of HP printer related to issues that may occur while printer setup. In case you are also facing such issues. You will get the most appropriate solution by visiting HP Printer Offlineor you may connect to us by dialing our toll free number.
ReplyDeleteHP Envy 5540 Printer Offline
Thank you for posting this detailed content. Keep it up!
ReplyDeleteRegards | https://realsleep.com/
Thanks a lot for such amazing content. dns_probe_finished_nxdomain
ReplyDeleteerr_ssl_version_or_cipher_mismatch
Flatsome Review
wordpress dedicated hosting
fast vps hosting
managed woocommerce hosting
WordPress hosting for agencies
Hello, If you want to buy your dream home without any brokeage then contact to our team and get exculsive offer.
ReplyDeleteBook Now why you are waiting for.
for more detail visit:- Best Residential Projects in Noida Extension
Hmm. This is definitely interesting.
ReplyDeletehttps://www.svgchevy.com/
I would love to know more about this.
ReplyDeletewww.carpetcleanercolumbia.com
Thank you for your sharing. Thanks to this blog I can learn more things. Expand your knowledge and abilities. Actually the article is very practical. For instant support related to AOL Desktop Gold Update Error then please contact our team for instant help.
ReplyDeleteYou got a really useful blog. I have been here reading for about an hour. I am a newbie and your success is very much an inspiration for me. For instant support related to QuickBooks Desktop Installation Errors please contact our technical expert for help related to QuickBooks.
ReplyDeleteThere were then 319 days left in 2018 in garage builders denver
ReplyDeleteI am reading a blog on this website for the first time and I would like to tell you that the quality of the content is up to the mark. It is very well written. Thank you so much for writing this blog and I will surely read all the blogs from now on. I also write blog and my latest blog is QuickBooks Express Web Connect Error
ReplyDeleteYeh rishta kya kehlata hai is a hindi reality tv show. If you want to watch it's free episodes
ReplyDeleteonline or download it's hd episodes than visit here.Hindi Desi Serials will be telecasted live.
Yeh rishta kya kehlata hai watch online
Yeh rishta kya kehlata hai watch live
Yeh rishta kya kehlata hai full episode
quickbooks error 15106 is a typical issue that happens because of difficulty in the update program. It ordinarily suggests that the update program has been upset prompting this unforeseen mistake. You might experience this blunder code on your screen while utilizing it. Relax, you can without much of a stretch fix this blunder with appropriate advances.
ReplyDeleteThere a different variety of datasets available in the market. Each one has some unique identify and features Create an online tv channel
ReplyDeleteOnline video platform providers help businesses and professionals to easily create and manage their video content on the world wide web.
ReplyDeleteThe top online video platform owners have many reasons to provide esteemed services to their approached audience like video sharing, generating leads, building product awareness, marketing, and assisting with paid access facility for video streaming.
ReplyDeleteSecure Cloud Video Platform that has strict security standards and privacy regulations helps mitigate risks of hacking, piracy
ReplyDeletehttps://vienthucung.com/ noi chia se tat tan tat nhung thong tin xoay quanh the gioi thu cung, vat nuoi hay các loai dong vat.
ReplyDeleteGlad to check this great blog. www.westfieldlandsurveying.com
ReplyDeleteGreat work.
ReplyDeleteVictorville trash removal
This was a great release. Thanks for sharing.
ReplyDeleteOur site
concrete companies 13201 zip code object-relational mapper (ORM) and business logic layer (BLL) framework.
ReplyDeleteA great resource in learning programming. bathroom remodeling Finsbury Park
ReplyDeleteData gathering techniques include interviews, questionnaires and observations. Interviews are best for exploring issues. They give qualitative and quantitative data. theology assignment help
ReplyDeleteassignment help
computer science assignment help
capstone project help online
article writer
content writer for hire
content writing services online
freelance writer for hire
ghost writer for hire online
write my assignments for me
That cause modification of Items collection and if such thing happens during the collection enumeration an exception will show up.
ReplyDeletehttps://www.google.com/maps?cid=7103629497482529158&_ga=2.141440049.229652753.1638346905-1925002581.1635364277
Contribute to DataObjects-NET/dataobjects-net development by creating an account on GitHub.
ReplyDeleteURL: https://www.overlandparkjunkremovalpros.com/
I found a way to work around a project I have been working on recently using the information here. Thank you so much.
ReplyDeletegocryptome.io
Phenol market - Phenol is a pungent natural mixture with the molecular formula C6H5OH and is also known as carbolic acid. Phenol is a chemical solvent extensively used in various places, such as chemistry, biology, and medical laboratories. Moreover, phenol exists in numerous consumer products that are swallowed or rubbed onto several body parts. These commodities include creams, ear and nose drops, cold sore lotions, mouthwashes, gargles, throat lozenges, and antiseptic lotions.
ReplyDeleteThanks for the great blog. Keep sharing. Foundation repair tulsa ok
ReplyDeleteGreat blog. Basement waterproofing wichita ks
ReplyDeleteA persist operation (saving changes) merges all the three sets into the first one, which caused an exception during enumeration. auto glass shop
ReplyDeleteSuch an informative site! Thanks for sharing this info. Keep on posting. https://www.bathroomremodelgreensboronc.com
ReplyDeleteAs a qualified security manager, I was hired by COO Mr. Mike Willy to safeguard the physical and the operational security of the company’s data system.
ReplyDeletetheology assignment help
assignment help online
computer science assignment help
capstone project help
article writer
content writer
content writing services
freelance writer
ghost writer
write my assignment for me
Sometimes inclusion of a static fields in operations like In() or Contains() resulted in the exception. Instance fields are handled correctly though. call us
ReplyDeleteHello! Just want to ask if is there any free version of this available?
ReplyDeleteusps mail forwarding
Great information, thanks for this. It's a really big help. best regards from https://www.clevelandbathroomremodel.com
ReplyDeleteGreat blog. Keep up the great work. fence company tulsa ok
ReplyDeleteNice info! Thanks for sharing a great site. https://www.eveliteseattle.com/
ReplyDeleteA persist operation (saving changes) merges all the three sets into the first one, which caused an exception during enumeration.
ReplyDeleteFrench drain repair San Francisco California
Detailed explanation of these changes is in the post.
ReplyDeleteoutdoor awnings in Cherry Hill New Jersey
First and foremost, thank you for all of your valuable insights. I'd want to thank you for emphasizing the importance of relevancy in the hosting market. I appreciate all of your efforts. Continue to share new updates with us. | See us
ReplyDeleteThank you for this information. Great work.
ReplyDeleteBathroom remodeling
Thanks for this article. Great work.
ReplyDeleterockland commercial cleaning
Awesome post
ReplyDeletehttps://www.bookmarkidea.win/customer-acquisition-service
In old times, books were uncommon and a couple of elites can approach books however presently in light of mechanical headway, everybody approaches schooling and data.
ReplyDeleteget the assistance with https://trevorlofk068.wordpress.com/2022/09/14/enough-already-15-things-about-an-industry-report-revealed-that-78-of-organizations-saw-team-coaching-in-increasing-demand-were-tired-of-hearing/
Great work on this article. Thank you.
ReplyDeleteconcrete driveway resurfacing
Thank you for sharing.
ReplyDeletemold testing companies
Amazing article, Thanks for sharing this one. fencingdundee.co.uk/
ReplyDeleteNice to visit such an informative blog. info
ReplyDeleteThanks for the updates.
ReplyDeletesell my car for cash today
This comment has been removed by the author.
ReplyDeleteThanks for sharing this information. Keep on posting. info
ReplyDeleteVery helpful details. learn more about us
ReplyDeleteLove your website. Keep up the good work. ReadMore: Kashmir Tour Packages
ReplyDeleteVery great information. Thanks. https://cincinnatiseo.org/
ReplyDeleteIm excited for the new versions!
ReplyDeletesecurity mesh
It's great to have a new version. Thanks. SEO for Video
ReplyDeleteDataObjects.Net is a persistence and object-relational mapping framework for the Microsoft .NET. It allows developers to define persistent objects as well as business logic directly in C#, Visual Basic or F#. https://www.iowacityconcretecontractors.com/
ReplyDeleteThese are the things we need to really learn more about.
ReplyDeletehttps://luminas.com/clinical-study/
Now only user changes can be the cause of enumeration termination.
ReplyDeleteJoana | concrete expert
Thanks for sharing so nice information....its a amazing work as well as idea. Kudos! Rick from house cleaning, looking forward to see more.
ReplyDeleteThanks for the sharing the useful information. This post is very amazing and useful. You are also read more then click here Online tuition for hindi. Thank You!
ReplyDeleteVery much appreciated. Thank you for this excellent article. Keep posting!
ReplyDeleteFence service Little Rock
Thanks for the information on this. Visit for more https://www.tejadostarragona.com/reparacion-de-goteras-y-humedades
ReplyDeleteThanks for sharing such a useful information. It is very helpful article. Very informative blog.
ReplyDeleteTree Removal in Calgary Ab
That is just great, thanks for showing this things to do in lake havasu city area
ReplyDeletevery informative article!!! thank you so much!
ReplyDeleteRed Deer Concrete
Your teaching help us excel in this field and help me find God. All the best!
ReplyDeleteThis is a helpful code. Thanks for sharing. Strive Holistic Massage
ReplyDeleteAwesome read you’ve got there, I’ll have to pass it on!
ReplyDeletehttps://plasticsurgerysacramento.net
I am glad I found this article, as it was exactly what I was looking for. I was having trouble finding information on this topic, but this article was very helpful. I appreciate the author for taking the time to write such a comprehensive and informative article.
ReplyDeletethefitnessstudiocharlotte.com
Dr. Dhanesh Agrahari is one of the best Pediatric Surgeon in Prayagraj .I have ever consulted for my kids.
ReplyDeleteThanks for sharing this information here. tree trimming
ReplyDeleteThese improvements aim to enhance the functionality and reliability of DataObjects.Net. Users can expect a more stable and efficient experience with these changes in place. Thank you for sharing this update on the software's improvements. blog
ReplyDeleteIt's great information you posted, thanks for the share. junk removal
ReplyDeleteIt seems like you've shared release notes for a new version of DataObjects.Net, highlighting specific changes and improvements made in this update. These changes include fixing scenarios leading to NullReferenceException during query translation, and addressing issues related to the termination of EntitySet items enumeration during the persist operation. https://luckeproperties.com/
ReplyDelete
ReplyDeleteGreat post! Thanks for the share. digital marketing agency
Your detailed explanation helps a lot!
ReplyDeleteThanks,
Best fence contractor in Atlanta
Great! Thanks for sharing this one. click
ReplyDeleteVery informative post. Glad to check this here. plasterer brisbane
ReplyDeleteThank you for providing the detailed explanation of the changes made in the new version of DataObjects.Net. It's clear that these changes address specific issues related to query operations and persistence behavior, particularly around handling null references and enumeration of EntitySet items during persistence. cincinnati-seo.com/
ReplyDelete
ReplyDeleteThank you for your kind words! I'm glad you found the article helpful. If you have any specific topics or questions you'd like to see covered in future posts, feel free to let me know. I'm here to help!
When using essential oils during cold and flu season, it's essential to dilute them properly and use them safely. You can diffuse them in the air, inhale them directly from the bottle, or apply them topically (diluted with a carrier oil) to the chest, back, or feet. Be sure to do a patch test before applying any essential oil to your skin, especially if you have sensitive skin or allergies. If you have any underlying health conditions or are pregnant, consult with a healthcare professional before using essential oils.https://www.rockymountainoils.com/blogs/personal-care/7-essential-oils-for-the-cold-and-flu-season
Great info you shared. Thanks. pool company Germantown
ReplyDeleteThanks for sharing!
ReplyDeleteRetail Flooring
Thanks for the great content! Pea Gravel
ReplyDeleteVery informative content! Alabama Artificial Grass artificial grass installation
ReplyDeleteGreat info you shared! Driveway
ReplyDeleteThanks for the great content! Kashmir Tour Package
ReplyDeleteGreat ideas here! Thanks for sharing. commercial painting contractor near me
ReplyDeleteThanks for the great post! concrete grinding
ReplyDeleteThanks for the great post! Charlotte Concreters concrete driveway
ReplyDeleteThis blog is fantastic! The points are well-made and the writing is excellent. Movers Abbotsford
ReplyDeleteGreat insights shared in this post! I appreciate the detailed breakdown on DataObjects.Net 5.0.17 Beta 3 – it's always helpful to stay updated with the latest advancements in technology. On a different note, for anyone planning a quick getaway, you might want to check out ASAP Holidays. We specialize in curating the Best Hill Stations near Bangalore for both domestic and international travelers. Whether you're looking for a peaceful retreat or an adventurous escape, we've got you covered with customizable packages that fit every budget. Safe travels!
ReplyDeleteIt made a complex topic much more accessible. Great job! Medicine Hat Roofing
ReplyDeleteThis works! Nice job Terraced Yards
ReplyDeleteKeep up the good work! topeka custodial services
ReplyDeleteSweet! Nice blog! Concrete Contractor
ReplyDeleteEthical supply chain management can give you a leg up on the competition. The world benefits from goods and services that are sustainably sourced and produced by businesses that prioritize ethics. party bus rental
ReplyDeleteYou just confirmed what I had in mind. Thanks for great blog! I learned a lot from this.
ReplyDeleteRetaining Wall Contractor
This is sweet! Landscape Design Halifax
ReplyDeleteThat's great to know. https://pinecreekpools.com/
ReplyDeleteThank you for providing a detailed explanation for Adrenaline Marketing Pros regarding this matter.
ReplyDeleteGreat insights on the new beta update of DataObjects.NET! It’s exciting to see the advancements in this technology. While tech innovations keep us busy, taking a break is equally important! For those looking to unwind, I recently came across a helpful blog about beach destinations near Bangalore. If you’re based in India or planning a trip to Bangalore, you might want to explore these scenic coastal spots for a refreshing weekend getaway. Check out some top recommendations here: Beach Places Near Bangalore. It's always nice to combine work and leisure!
ReplyDeleteGlad to check this site, it's a great blog indeed. pool cage screening
ReplyDeleteThank you for the effort you took to share this incredible post. Elite Roofing Sacramento Roofer
ReplyDeleteWow, those fixes sound really useful, especially the one for the NullReferenceException in queries—that must have been frustrating. I also like how they handled the EntitySet issue during enumeration; that could save a lot of headaches when working with collections. It's good to know everything works as expected now unless you're actively modifying the collection. By the way, make sure to check out our website at Office Design Edmonton for more updates!
ReplyDeleteA persist operation saving changes merges all the three sets into the first one, the Top drywall company in Atlanta which caused an exception during enumeration.
ReplyDeleteInteresting. I like this article Excavation Service Contractor
ReplyDeleteHello Dear Sir, this blog post is very useful information for the new bloggers, your blog post went to get a lot of new education after I read it,
ReplyDeletePlease continue to post such an informative blog. Therefore, people like us will be motivated in real life.
cheap kashmir tour packages