Not able to call new methods from IAuditService

Jan 10, 2012 at 8:26 AM

Hi Pete,

I have added some extra methods to your IAuditService interface (and class AuditService) for retrieving data from the auditrecord table, strangely, i can reference the methods in code but at runtime, it keeps on saying error 'method not found', although they are definitely there, as i can call them from the interface at design time. Any ideas?

It feels as though Orchard has somehow cached the new methods, because the original methods are available at runtime. I have tried renaming the mappings.bin (for refresh of data) and renamed cache.dat (to refresh the cache), clearing out the dependencies folder, disabling and re-enabling the audit modules, clearing out my temporary files, but now i am at a loss as to what to do with it. Can you shed any light on what else i could try? Or is there something in the database that needs to be updated? Any help would be gratefully received. Do i need to add a migration script(no db changes have been made) to refresh it?

On a seperate note i am working on an audit view module which is rendering the audit record information, i have tailored it to more my use, but once its done, i'll send it to you and you can by all means chop it up and include it as part of your module which may be quite useful to have it all in one place for other people (i did try and extend yours but i came across some issues around rendering the view which i wasn't able to address, so thought it was easier to create a new module)

Thanks

Dom

Jan 10, 2012 at 9:51 AM

It seems that the audit assembly file, was stored in my temporary internet files ...\Users\...\appData\Local\Temp\Temporary ASP.NET Files\root\.... folder, even though i cleared out my temporary files, and was out of date, i removed it and then rebuild it and all seems fine for anyone else who is pulling their hair out because for some reason things weren't updating assemblies

Coordinator
Jan 10, 2012 at 12:18 PM

Ok, good to know. By the way what rendering problems were you having trying to extend it?

Jan 11, 2012 at 9:13 AM

From my recollection, i was unable to view the views i created, i think i had it set as ../Views/Audit/AuditSearch.cshtml but could not browse to /Audit/AuditSearch, as i had added a route

                new RouteDescriptor {
                    Priority = 5,
                    Route = new Route(
                        "Audit/{action}",
                        new RouteValueDictionary {
                            {"area", "Downplay.Audit"},
                            {"controller", "Audit"},
                            {"action", "AuditSearch"}
                        },
                        new RouteValueDictionary(),
                        new RouteValueDictionary {
                            {"area", "Downplay.Audit"}
                        },
                        new MvcRouteHandler())
		}
I think it had something to do with the Content Item stuff which i am still not 100% comfortable with. Maybe i needed to add something to the migration.cs file like
ContentDefinitionManager.AlterPartDefinition(
                           typeof(AuditRecord).Name, cfg => cfg.Attachable());

but i'm sure i did that i just gave up and thought maybe i'm missing something, so created my own module. hope that helps, i also think because it was a content item, it asked me for a contentpart, so i had to create the content part and contentpartrecord from auditrecord. My module is fairly straight forward so once i've completed it in the next day or so, i'll send it through to you and you can do with it what you want. Thanks again for your help.

I think Orchard is really good as a wrapper around modules that you want to create, but there are definitely some ideosyncrasies, for instance, the mappings.bin and cache.dat, transactionscope (that was a big headache) and MVC itself is a little awkward from time to time, but generally we are producing a pretty good piece of software from it.

On a slight tangent, i remember reading about some work on quanta, and extending the permissions part of Orchard, i think you did it didn't you, i wasn't able to find it  and was wondering where it might be found.

I have extended Piotr advanced menu to give the facility to chose a role for a menu item and hide it or grey it out, but i think there may be some short comings for the content item pages (i don't really use them) as it is currently not possible to restrict these by roles, something i think your quanta module does. Any info would be great.

Coordinator
Jan 11, 2012 at 10:05 AM

It shouldn't have anything to do with content; AuditRecord isn't a content part, it's a record in its own table. That's why it reads from IRepository<AuditRecord> instead of going through IContentManager. You only create content parts if you want to attach stuff to a content item, whereas Audit is storing data about a variety of events that may or may not be content-related.

So it was either a problem with your route or controller. Where were you being asked for a content part? What was in your controller...

Anyway it'll be good to get some reporting in there so I look forward to seeing your work. I'm planning on doing some kind of Javascript/SVG graphing integration so we could get some nice visual outputs in there as well...

Yeah, Orchard can be a headache now and then but once you get used to the various concepts and conventions it gets a lot easier. Content items/parts and what they do and don't cover seems to be a common confusion!

Quanta is in the Science Project modules (http://scienceproject.codeplex.com), unfortunately "View" permissions are something I never got around to sorting out 100%, it's still on my to-do list ;) Actually I can do it pretty easily now after the recent changes, and it does allow per-user and grouped permissions. The big problem is the versions on the Orchard Gallery are now very old and buggy and I won't actually be updating them until Orchard 1.4 is out! The source code on the Codeplex site is pretty much working again now after some massive rewrites, but you also need my Autoroute fork for all the features to work properly.