I have a problem where my relation keeps returning zero relational objects (in this case bank accounts).
Could someone take a quick look at my code and see if I'm doing something wrong?
The reason to the business logic in the property is due to a de-coupling of the database and the business logic.
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using OpenFridge.Portable.Data.Interfaces.Entities;
using OpenFridge.Portable.Data.Parse.Entities;
using Parse;
using AutoMapper;
namespace OpenFridge.Portable.Data.Parse.Entities
{
[ParseClassName("_User")]
public class ParseUserEntity : ParseUserEntityBase, IUserEntity
{
private string _password;
[ParseFieldName("password")]
public new string Password
{
get { return _password; }
set
{
_password = value;
base.Password = value;
}
}
Lazy<IEnumerable<IBankAccountEntity>> _bankAccounts;
[ParseFieldName("bankAccounts")]
public Lazy<IEnumerable<IBankAccountEntity>> BankAccounts
{
get
{
var relation = GetRelation<ParseBankAccountEntity>("bankAccounts");
if (relation == null)
return null;
var _bankAccounts = new Lazy<IEnumerable<IBankAccountEntity>>(() => relation.Query.FindAsync().Result);
return _bankAccounts;
}
set
{
_bankAccounts = value;
}
}
}
}
I suspect that this keeps getting returned as empty due to the fact that
this.ObjectId hasn't been set yet before the BankAccounts code executes..
Any ideas of how to get this working?
Related
So I'm trying to retrieve data from a database to display it in a table.
(This is a WebApi project). The idea is to go through all the prodactivity from the table whose status is 1. Put them in some list and return it.
To do this, I need to convert a TBL object to DAL. but here I am stuck. It is unable to perform a conversion and is therefore unwilling to return an object of a different type.
I tried to convert in all sorts of ways but it'S out of sync with the type in the controller.
This is my code: (do'nt look at the other functions. Look at the function getProductivityRequest at the end)
UserController.cs
using BL;
using DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Cors;
namespace WebApiSystem.Controllers
{
[EnableCors(origins: "*", headers: "*", methods: "*")]//SupportsCredentials = true
[RoutePrefix("api/User")]
public class UserController : ApiController
{
[HttpGet]
[Route("login/{email}/{pass}")]
public IHttpActionResult LogIn(string email, string pass)
{
UserDTO user = BL.UserService.LogIn(email, pass);
if (user != null)
return Ok(user);
return NotFound();
}
[Route("register")]
public IHttpActionResult Register(UserDTO user)
{
return NotFound();
}
[HttpPost]
[Route("productivity")]
public IHttpActionResult InsertProductivity([FromBody] ProductivityDTO p)
{
bool b = BL.UserService.InsertProductivity(p);
if (b)
return Ok(b);
return BadRequest();
}
[HttpGet]
[Route("getProductivityRequest")]
public IHttpActionResult GetProductivityRequest()
{
return Json(BL.UserService.GetProductivityRequest());
}
}
}
UserService.cs
using DAL;
using DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BL
{
public class UserService
{
public static UserDTO LogIn(string email, string pass)
{
using (Model2 db = new Model2())
{
UserTbl user = db.UserTbl.FirstOrDefault(u => u.UserEmail == email && u.UserPassLogin == pass);
if (user == null)
return null;
return CONVERTERS.UserConverter.ConvertUsertoDTO(user);
}
}
public static bool InsertProductivity(ProductivityDTO p)
{
using (Model2 db = new Model2())
{
//conver dal to dto
ProductivityTbl prod = BL.CONVERTERS.ProductivityConverter.ProductivityDal(p);
prod.ProductivityStatus = 1;
db.ProductivityTbl.Add(prod);
db.SaveChanges();
return true;
}
return false;
}
public static ProductivityDTO GetProductivityRequest()//Here I can not convert
{
using (Model2 db = new Model2())
{
List<ProductivityDTO> PList = new List<ProductivityDTO>();
foreach (var item in db.ProductivityTbl.ToList())
{
if(item.ProductivityStatus==1)
{
ProductivityDTO prod = BL.CONVERTERS.ProductivityConverter.ConvertProductivitytoDTO(item);
PList.Add(prod);
}
}
return (PList);//He's unable to return the object
}
}
}
}
ProductivityConverter.cs(if it's relevant...)
using DTO;
using DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BL.CONVERTERS
{
class ProductivityConverter
{
public static ProductivityDTO ConvertProductivitytoDTO(ProductivityTbl productivity) {
return new ProductivityDTO
{
ProductivyCode = productivity.ProductivyCode,
ProductivityNum = productivity.ProductivityNum,
ProductivityStatus = productivity.ProductivityStatus,
UserCode = productivity.UserCode,
Cmment = productivity.Cmment,
Date = productivity.Date
};
}
public static ProductivityTbl ProductivityDal(ProductivityDTO productivity)
{
return new ProductivityTbl
{
ProductivyCode = productivity.ProductivyCode,
ProductivityNum = productivity.ProductivityNum,
ProductivityStatus = productivity.ProductivityStatus,
UserCode = productivity.UserCode,
Cmment = productivity.Cmment,
Date = productivity.Date
};
}
}
}
If anyone knows of another way to transfer the data I would love ideas.
Thanks!
Your method returns a ProductivityDTO:
public static ProductivityDTO GetProductivityRequest()
...but you are trying to return PList which is a List<ProductivityDTO>.
Your method signature should be:
public static List<ProductivityDTO> GetProductivityRequest()
Although your comment suggests you can't change the method signature. In which case you need to return just one DTO. How you determine which one is up to you. But if it were just one with a ProductivityStatus of 1 then you could do:
public static ProductivityDTO GetProductivityRequest()//Here I can not convert
{
using (Model2 db = new Model2())
{
return BL.CONVERTERS.ProductivityConverter.ConvertProductivitytoDTO(db.ProductivityTbl.FirstOrDefault(p => p.ProductivityStatus == 1)));
}
}
Your function is defined to return a single ProductivityDTO.
But your function is building a List<ProductivityDTO> and returning that.
Change your function return type to a collection type, such as:
public static List<ProductivityDTO> GetProductivityRequest()
or
public static IEnumerable<ProductivityDTO> GetProductivityRequest()
when i run a method within my WCF service i get "An unhandled exception of type 'System.StackOverflowException' occurred in developer1SVC.dll".
No infinite loops exist and no infinite recursion is occurring. Any ideas to why this may be happening? when i run the method through wcf test client. I get the results back correctly however, hooking it up to my console app and running it breaks the application. The other methods run fine. It is this one method. Just trying to get the feel for WCF services. The service breaks right after i return accounts from the "generateMultiplAccounts" method.
Much help appreciated.
Service
using developer1.Core.ServiceContracts;
using developer1.Core.Data;
using developer1.Core.Dto;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using developer1.Core.Dto.Account;
namespace developer1.Core.Service
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and config file together.
// NOTE: In order to launch WCF Test Client for testing this service, please select Service1.svc or Service1.svc.cs at the Solution Explorer and start debugging.
public class Service1 : IService1
{
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
public CompositeType GetDataUsingDataContract(CompositeType composite)
{
if (composite == null)
{
throw new ArgumentNullException("composite");
}
if (composite.BoolValue)
{
composite.StringValue += "Suffix";
}
Console.WriteLine(composite.StringValue + composite.BoolValue);
return composite;
}
public List<AccountDto> GenerateMultipleAccounts(int count)
{
List<AccountDto> accounts = new List<AccountDto>();
for (int i = 0; i < count; i++)
{
AccountDto newAccount = new AccountDto() { AccountId = Guid.NewGuid()};
accounts.Add(newAccount);
}
return accounts;
}
}
}
Console Application
using developer1.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using developer1.Core.Service;
using developer1.Core.Dto.Account;
using developer1.Core.ServiceContracts;
using AccountServiceClient = developer1.TestConsole.ServiceReference1.Service1Client;
namespace developer1.TestConsole
{
class Program
{
static void Main(string[] args)
{
try
{
AccountServiceClient AccountServiceClient = new AccountServiceClient();
Guid testGuid = Guid.NewGuid();
List<AccountDto> newAccounts = new List<AccountDto>(AccountServiceClient.GenerateMultipleAccounts(2));
Console.WriteLine(testGuid);
CompositeType testDataContract = new CompositeType() { StringValue = "test", BoolValue = true };
testDataContract = AccountServiceClient.GetDataUsingDataContract(testDataContract);
Console.WriteLine(AccountServiceClient.GetData(6));
Console.WriteLine(testDataContract.StringValue);
//foreach (var item in newAccounts)
//{
// Console.WriteLine(item.AccountId);
//}
}
catch(Exception e) {
Console.WriteLine(e);
}
Console.Read();
}
}
}
Data Contract
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Web;
namespace developer1.Core.Dto.Account
{
[DataContract]
public class AccountDto
{
[DataMember]
public Guid AccountId { get; set; }
//get { return this.AccountId; }
//set { this.AccountId = this.AccountId == Guid.Empty ? Guid.NewGuid() : value; }
[DataMember]
public Guid UserId { get; set; }
[DataMember]
public string AccountName { get; set; }
[DataMember]
public string BankName { get; set; }
//get { return this.BankName; }
//set { this.BankName = this.BankName == null ? "Unspecified" : value; }
}
}
ANSWER!!!!!!!
So I have solved this dreaded issue. You must create a WCF Service Library instead of a WCF Service Application. My god that is stupid that the application wont let you split your components outside of the interface.
I have the following code:
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using OpenFridge.Portable.Data.Interfaces.Entities;
using OpenFridge.Portable.Data.Parse.Entities;
using Parse;
using AutoMapper;
namespace OpenFridge.Portable.Data.Parse.Entities
{
[ParseClassName("_User")]
public class ParseUserEntity : ParseUserEntityBase, IUserEntity
{
private string _password;
[ParseFieldName("password")]
public new string Password
{
get { return _password; }
set
{
_password = value;
base.Password = value;
}
}
Lazy<IEnumerable<IBankAccountEntity>> _bankAccounts;
[ParseFieldName("bankAccounts")]
public Lazy<IEnumerable<IBankAccountEntity>> BankAccounts
{
get
{
var relation = GetRelation<ParseBankAccountEntity>("BankAccount");
if (relation == null) return null;
var result = relation.Query.FindAsync().Result;
var _bankAccounts = new Lazy<IEnumerable<IBankAccountEntity>>(() => relation.Query.FindAsync().Result);
return _bankAccounts;
}
set
{
_bankAccounts = value;
}
}
}
}
And it all seems to work quite fine, however.. once I use the .BankAccounts property I get the following exception:
Must specify a ParseObject class name when creating a ParseQuery.\r\nParameter name: className
Which I find strange since there is no way for me to define a classname with in that line of code:
(That line of code beeing:)
relation.Query.FindAsync().Result
So.. is this a bug?.. Am I doing something wrong or using it wrong?
Any ideas?
Br,
Inx
I'm trying to create a simple service using the code provided but i don't understand why have an exception when binding.
10-19 11:42:09.148 I/mono-stdout( 1622): MvxBind:Error: 10.40 Exception thrown during the view binding
MvxBindingLayoutInflatorFactory Line 133!
I need some help please :)
My Source:
DataStore Interface:
using Core.Models;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
namespace Core.Interfaces
{
public interface IDataStore
{
void UpdateFeed(FeedModel feedModel);
void DeleteFeed(FeedModel feedModel);
void CreateFeed(FeedModel feedModel);
FeedModel GetFeed(Uri uri);
ObservableCollection<FeedModel> Feeds { get; }
}
}
DataStore Class:
using System;
using System.Collections.Generic;
using System.Linq;
using Core.Interfaces;
using System.Collections.ObjectModel;
using Cirrious.MvvmCross.Interfaces.ServiceProvider;
using Cirrious.MvvmCross.Interfaces.Platform;
using Cirrious.MvvmCross.Interfaces.Localization;
using Cirrious.MvvmCross.ExtensionMethods;
using Core.Helpers;
using System.Xml.Serialization;
using System.Xml.Linq;
using System.IO;
namespace Core.Models
{
public class DataStore
: IDataStore
, IMvxServiceConsumer<IMvxSimpleFileStoreService>
, IMvxServiceConsumer<IMvxResourceLoader>
{
public DataStore()
{
Load();
}
public void UpdateFeed(FeedModel feedModel)
{
var toUpdate = this.m_feeds.First(feed => feed.Url == feedModel.Url);
toUpdate.CloneFrom(feedModel);
Save();
}
public void DeleteFeed(FeedModel feedModel)
{
this.m_feeds.Remove(this.m_feeds.First(feed => feed.Url == feedModel.Url));
Save();
}
public void CreateFeed(FeedModel feedModel)
{
this.m_feeds.Add(feedModel);
Save();
}
public FeedModel GetFeed(Uri uri)
{
return this.m_feeds.First(feed => feed.Url == uri);
}
private void Load()
{
var fileService = this.GetService<IMvxSimpleFileStoreService>();
if (!fileService.TryReadBinaryFile(LocationDataService.StoreFileName, LoadFrom))
{
var resourceLoader = this.GetService<IMvxResourceLoader>();
resourceLoader.GetResourceStream(LocationDataService.ResourceFileName, (inputStream) => LoadFrom(inputStream));
}
}
private bool LoadFrom(Stream inputStream)
{
try
{
var loadedData = XDocument.Load(inputStream);
if (loadedData.Root == null)
return false;
using (var reader = loadedData.Root.CreateReader())
{
var list = (List<FeedModel>)new XmlSerializer(typeof(List<FeedModel>)).Deserialize(reader);
this.m_feeds = new ObservableCollection<FeedModel>(list);
return true;
}
}
catch
{
return false;
}
}
private void Save()
{
var fileService = this.GetService<IMvxSimpleFileStoreService>();
fileService.WriteFile(LocationDataService.StoreFileName, (stream) =>
{
var serializer = new XmlSerializer(typeof(List<FeedModel>));
serializer.Serialize(stream, m_feeds.ToList());
});
}
private ObservableCollection<FeedModel> m_feeds;
public ObservableCollection<FeedModel> Feeds
{
get { return this.m_feeds; }
}
}
}
BaseViewModel:
using Cirrious.MvvmCross.Commands;
using Cirrious.MvvmCross.ExtensionMethods;
using Cirrious.MvvmCross.Interfaces.Commands;
using Cirrious.MvvmCross.Interfaces.ServiceProvider;
using Cirrious.MvvmCross.ViewModels;
using Core.Interfaces;
namespace Core.ViewModels
{
public class BaseViewModel
: MvxViewModel
, IMvxServiceConsumer<IDataStore>
{
protected IDataStore DataStore
{
get { return this.GetService<IDataStore>(); }
}
}
}
FeedManagerViewModel:
using Cirrious.MvvmCross.Commands;
using Cirrious.MvvmCross.Interfaces.Commands;
using Core.Controls;
using Core.Models;
using System;
using System.Collections.ObjectModel;
namespace Core.ViewModels
{
public class FeedsManagerViewModel
: BaseViewModel
{
public ObservableCollection<FeedModel> Feeds { get { return this.DataStore.Feeds; } }
...
}
}
View xml:
<Mvx.MvxBindableListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
local:MvxBind="{'ItemsSource':{'Path':'Feeds'}, 'ItemClick':{'Path':'DisplayItemCommand'}}"
local:MvxItemTemplate="#layout/feedlist_viewmodel" />
This is most likely an error in your XML... but it's hard to tell from just that one line of trace.
What version of MvvmCross are you running?
The tip version of both Master and vNext show line 133 as
MvxBindingTrace.Trace(MvxTraceLevel.Error, "Exception during creation of {0} from type {1} - exception {2}", name, viewType.FullName, exception.ToLongString());
So hopefully if you use the tip, then that should give you a lot more information about what is going wrong.
Beyond that, you can always try setting a breakpoint on the offending line to extract more information.
If the exception is on line 99 then change the error logging there from:
MvxBindingTrace.Trace(MvxTraceLevel.Error, "Exception thrown during the view binding ", exception.ToLongString());
to:
MvxBindingTrace.Trace(MvxTraceLevel.Error, "Exception thrown during the view binding {0}", exception.ToLongString());
The error will be in there somewhere :)
Another good debugging technique is to comment out lines one-by-one until the problem goes away - this helps identify where the problem is.
You've got a working development environment and a really powerful debugger - using it is a good skill to learn. 'Code Complete' is one of my favourite books ever :)
I want to do exactly what this question asks:
Cascade Saves with Fluent NHibernate AutoMapping
Using Fluent Nhibernate Mappings to turn on "cascade" globally once for all classes and relation types using one call rather than setting it for each mapping individually.
The answer to the earlier question looks great, but I'm afraid that the Fluent Nhibernate API altered its .WithConvention syntax last year and broke the answer... either that or I'm missing something.
I keep getting a bunch of name space not found errors relating to the IOneToOnePart, IManyToOnePart and all their variations:
"The type or namespace name 'IOneToOnePart' could not be found (are you missing a using directive or an assembly reference?)"
I've tried the official example dll's, the RTM dll's and the latest build and none of them seem to make VS 2008 see the required namespace.
The second problem is that I want to use the class with my AutoPersistenceModel
but I'm not sure where to this line:
.ConventionDiscovery.AddFromAssemblyOf()
in my factory creation method.
private static ISessionFactory CreateSessionFactory()
{
return Fluently.Configure()
.Database(SQLiteConfiguration.Standard.UsingFile(DbFile))
.Mappings(m => m.AutoMappings
.Add(AutoMap.AssemblyOf<Shelf>(type => type.Namespace.EndsWith("Entities"))
.Override<Shelf>(map =>
{
map.HasManyToMany(x => x.Products).Cascade.All();
})
)
)//emd mappings
.ExposeConfiguration(BuildSchema)
.BuildSessionFactory();//finalizes the whole thing to send back.
}
Below is the class and using statements I'm trying
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using FluentNHibernate.Conventions;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using FluentNHibernate.Mapping;
namespace TestCode
{
public class CascadeAll : IHasOneConvention, IHasManyConvention, IReferenceConvention
{
public bool Accept(IOneToOnePart target)
{
return true;
}
public void Apply(IOneToOnePart target)
{
target.Cascade.All();
}
public bool Accept(IOneToManyPart target)
{
return true;
}
public void Apply(IOneToManyPart target)
{
target.Cascade.All();
}
public bool Accept(IManyToOnePart target)
{
return true;
}
public void Apply(IManyToOnePart target)
{
target.Cascade.All();
}
}
}
The easiest way I've found to do this for a whole project is to use DefaultCascade:
.Conventions.Add( DefaultCascade.All() );
Go to "The Simplest Conventions" section on the wiki, for this, and a list of others.
Edit:
Here's the list from the Wiki:
Table.Is(x => x.EntityType.Name + "Table")
PrimaryKey.Name.Is(x => "ID")
AutoImport.Never()
DefaultAccess.Field()
DefaultCascade.All()
DefaultLazy.Always()
DynamicInsert.AlwaysTrue()
DynamicUpdate.AlwaysTrue()
OptimisticLock.Is(x => x.Dirty())
Cache.Is(x => x.AsReadOnly())
ForeignKey.EndsWith("ID")
A word of warning - some of the method names in the Wiki may be wrong. I edited the Wiki with what I could verify (i.e. DefaultCascade and DefaultLazy), but can't vouch for the rest. But you should be able to figure out the proper names with Intellisense if the need arises.
Here's a full working example similar to the Getting Started guide https://github.com/jagregory/fluent-nhibernate/wiki/Getting-started
//=====CONSOLE MAIN
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using NHibernate;
using NHibernate.Cfg;
using NHibernate.Tool.hbm2ddl;
using System.IO;
using FluentNHibernate.Automapping;
using App4.Entities;
using System.Diagnostics;
namespace App4
{
class Program
{
static void Main(string[] args)
{
// create our NHibernate session factory
var sessionFactory = CreateSessionFactory();
using (var session = sessionFactory.OpenSession())
{
// populate the database
using (var transaction = session.BeginTransaction())
{
// create a couple of Stores each with some Products and Employees
var topShelf = new Shelf();
var sw = new Stopwatch();
sw.Start();
for (var i = 0; i < 1000; i++)
{
var potatoes = new Product { Name = "Potatoes" + i.ToString(), Price = 3.60 + i };
var meat = new Product { Name = "Meat" + i.ToString(), Price = 4.49 + i };
//session.SaveOrUpdate(potatoes); //===<<cascading save handles this :-)
//session.SaveOrUpdate(meat);
topShelf.Products.Add(meat);
topShelf.Products.Add(potatoes);
}
sw.Stop();
session.SaveOrUpdate(topShelf);
//session.SaveOrUpdate(superMart);
transaction.Commit();
Console.WriteLine("Add Items: " + sw.ElapsedMilliseconds);
}
}
using (var session = sessionFactory.OpenSession())
{
// retreive all stores and display them
using (session.BeginTransaction())
{
var shelves = session.CreateCriteria(typeof(Shelf)).List<Shelf>();
foreach (var store in shelves)
{
WriteShelfPretty(store);
}
}
}
Console.ReadLine();
}
private const string DbFile = "FIVEProgram.db";
private static ISessionFactory CreateSessionFactory()
{
return Fluently.Configure()
.Database(SQLiteConfiguration.Standard.UsingFile(DbFile))
.Mappings(m => m.AutoMappings
.Add(AutoMap.AssemblyOf<Shelf>(type => type.Namespace.EndsWith("Entities"))
.Override<Shelf>(map =>
{
map.HasManyToMany(x => x.Products);//.Cascade.All();
})
.Conventions.AddFromAssemblyOf<CascadeAll>()
)
) //emd mappings
.ExposeConfiguration(BuildSchema)//Delete and remake db (see function below)
.BuildSessionFactory();//finalizes the whole thing to send back.
}
private static void BuildSchema(Configuration config)
{
// delete the existing db on each run
if (File.Exists(DbFile))
File.Delete(DbFile);
// this NHibernate tool takes a configuration (with mapping info in)
// and exports a database schema from it
new SchemaExport(config)
.Create(false, true);
}
private static void WriteShelfPretty(Shelf shelf)
{
Console.WriteLine(shelf.Id);
Console.WriteLine(" Products:");
foreach (var product in shelf.Products)
{
Console.WriteLine(" " + product.Name);
}
Console.WriteLine();
}
}
}
//Data Classes
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace App4.Entities
{
public class Product
{
public virtual int Id { get; private set; }
public virtual string Name { get; set; }
public virtual double Price { get; set; }
}
public class Shelf
{
public virtual int Id { get; private set; }
public virtual IList<Product> Products { get; private set; }
public Shelf()
{
Products = new List<Product>();
}
}
}
//Cascade All Helper Class
using FluentNHibernate.Conventions;
using FluentNHibernate.Conventions.AcceptanceCriteria;
using FluentNHibernate.Conventions.Inspections;
using FluentNHibernate.Conventions.Instances;
using System;
using System.Collections.Generic;
namespace App4
{
public class CascadeAll :
IHasOneConvention, //Actually Apply the convention
IHasManyConvention,
IReferenceConvention,
IHasManyToManyConvention,
IHasOneConventionAcceptance, //Test to see if we should use the convention
IHasManyConventionAcceptance, //I think we could skip these since it will always be true
IReferenceConventionAcceptance, //adding them for reference later
IHasManyToManyConventionAcceptance
{
//One to One
public void Accept(IAcceptanceCriteria<IOneToOneInspector> criteria)
{
//criteria.Expect(x => (true));
}
public void Apply(IOneToOneInstance instance)
{
instance.Cascade.All();
}
//One to Many
public void Accept(IAcceptanceCriteria<IOneToManyCollectionInspector> criteria)
{
//criteria.Expect(x => (true));
}
public void Apply(IOneToManyCollectionInstance instance)
{
instance.Cascade.All();
}
//Many to One
public void Accept(IAcceptanceCriteria<IManyToOneInspector> criteria)
{
// criteria.Expect(x => (true));
}
public void Apply(IManyToOneInstance instance)
{
instance.Cascade.All();
}
//Many to Many
public void Accept(IAcceptanceCriteria<IManyToManyCollectionInspector> criteria)
{
// criteria.Expect(x => (true));
}
public void Apply(IManyToManyCollectionInstance instance)
{
instance.Cascade.All();
}
}
}
The signature for the conventions has changed. Are you not using something like ReSharper? That would point you to that conclusion.
You can read more about the new conventions on the wiki.