How to save AbpEntityChanges data in database of the entity table? - abp

I want to use entity change functionality and enabled it from .Application section
but it's not working.
When I download github repo and check in .NetCore EntityFramwork IEntityHistoryHelper class. but this using in commonDBContext but object not created.
Can you please explain how to resolve dependency or user IEntityHistoryHelper in application.
Your ABP Framework version.= 7.3.0.0
Your User Interface type (Angular/MVC/React... etc.) if the issue is related to a specific UI = MVC
Your database provider(EF Core/MongoDB)=EF Core

Related

IdentityServer4 QuickStart Register Issue

I have ASP.NET Core application with IdentityServer4 using ASP.NET Core Identity (based on excellent quickstart).
http://docs.identityserver.io/en/release/quickstarts/6_aspnet_identity.html
In the walkthrough blog they talk about navigating to localhost:5000/Account/Register to create a new user in the Identity db.
When i navigate to that url i get a white page. Furthermore I don't have a Register.cshmtl page or a Register route or anything with the term Register in it.
Did i get the wrong branch? because i am on the release and using core 2.0
I'm new at this and apologize if i'm missing something obvious.
I have run the dotnet ef command but can't see a db anywhere I look - like in sql express or LocalDb.
I am running the Identity server project out of vs17 on port 5000
If i run the MvcClient project I see the home page with the Secure link. If i click that i am directed to the IS4 instance but alice nor bob login will work. (invalid us/pw).
And i can see in the logs that alice and bob users are not being created in-memory
You probably got this by now, but it might interest someone else.
The Quickstart UI repository is not a direct implementation of the tutorials in the IdentityServer4 docs. If you follow the docs, you will first create a new ASP.NET Core MVC application with Individual User Accounts authentication, and that template will create the registration page.
I think your problem is about routing. With scaffolding Identity and specifying routing Your problem will be resolved.
To maintain full control of the Identity UI, run the Identity
scaffolder and select Override all files.
replace
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
with
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1)
.AddRazorPagesOptions(options =>
{
options.AllowAreas = true;
options.Conventions.AuthorizeAreaFolder("Identity", "/Account/Manage");
options.Conventions.AuthorizeAreaPage("Identity", "/Account/Logout");
});
services.ConfigureApplicationCookie(options =>
{
options.LoginPath = $"/Identity/Account/Login";
options.LogoutPath = $"/Identity/Account/Logout";
options.AccessDeniedPath = $"/Identity/Account/AccessDenied";
});
// using Microsoft.AspNetCore.Identity.UI.Services;
services.AddSingleton<IEmailSender, EmailSender>();
Now you can access to Register account page:
http://localhost:5000/Identity/Account/Register
You also can also change default route like what you want (localhost:5000/Account/Register) for this purpose check this post

What are the differences between mobiledata and cloudant services?

hello I am analyzing these two services to use In my app, and I could not find some doc about the difference between these two services. I know that mobiledata extends the cloudant, but what are the pro and cons? In my case I need to have more control above the data, for example create views (I could not create In mobiledata service) etc
So, do you know what the main divergences between these two services? When to use mobile data or cloudant?
Thanks
There are three ways to use Cloudant on Bluemix from an iOS application:
Use Cloudant directly by adding it as a service to your application.
Use MobileFirst for iOS, the Data part specifically (currently beta).
Use the Mobile Data cross-platform SDK.
(1) and (2) allow you to use views within Cloudant by adding them
via either the Cloudant dashboard or by using the Cloudant HTTP API.
(3) is a service which uses Cloudant in the background, but provides
no direct access to your data using the Cloudant HTTP API; you're
limited to the services exposed by the SDK. Therefore you can't use
many Cloudant features like views or Cloudant Query. Think of
Cloudant more as an implementation detail here, rather than an
exposed component as it is for (1) and (2).
Therefore, (1) or (2) is probably more suitable for your needs as
you mention wanting to use views.
Backend of mobile data service of bluemix is cloudant.For details please refer below link on getting started:
https://www.ibm.com/developerworks/cloud/library/cl-rapiddev-app/
http://www.techrepublic.com/blog/the-enterprise-cloud/managing-your-databases-in-the-cloud-how-cloudant-does-it/
https://www.ibm.com/developerworks/cloud/library/cl-rapiddev-app/
P.S- Cloudant is no-sql(create view wont be supported) DBAAS
For details on no-sql,please follow below link:
http://www.zdnet.com/article/what-is-nosql-and-why-do-you-need-it/
Cloudant is the IBM bluemix mobile data backend. And yes you can build sorted secondary key:value indexes, called "views" using JavaScript MapReduce functions.
Here is an example :
map: function(doc){
if (doc.rep){ emit({"rep": doc.rep}, doc.amount); }
}
reduce: _sum
For more details you can refer these links :
http://examples.cloudant.com/sales/_design/sales/index.html
http://examples.cloudant.com/sales/_design/sales/index.html#basic
http://examples.cloudant.com/whatwouldbiebersay/_design/whatwouldbiebersay/index.html
For mobiledata cloudant is acting behind the scenes. Cloudant is an open source
non-relational, distributed database service of the same name that requires zero-configuration.
Cloudant is based on the Apache-backed CouchDB project and the open source BigCouch
project.
Please follow below link for more details:
https://cloudant.com/cloudant-ibm-bluemix-tutorials-and-demos/

Access Sitecore DB from API in Console application

I would like to accesss the sitecore DB and items from console application like
Sitecore.Data.Database db = Sitecore.Context.Database
or
Sitecore.Data.Database db = Sitecore.Data.Database.GetDatabase("master")
how do I configure and setup my console application to access the DB as above?
Thanks Everyone for the suggestion, I am really interested in config changes, I used webservice, but it has very limited methods. For example, if I would like create an Item with the template and insert the item with prepopulated value, there is no such option. The reason I am looking for the console apporach is I would like to import the contents from XML or excel sheet and push those to the sitecore tree, eventually use the scheduled task to run the console app periodically. I do not want to copy the entire web.config and app_config. If anyone has already done this, could you please post your steps and necessary config changes?
You have two options I think:
1) Import the Sitecore bits of a website's web.config into your console application's app.config, so that the Sitecore API "just works"
I'm sure I read a blog post about this, but I can't find the reference right now. (I will have another look) But I think the simple but long winded approach is to copy all of the <sitecore/> element and all the separate files it references. I'm fairly sure you can whittle this down to a subset of the config required for data access with a bit of thinking.
2) Don't use the Sitecore API directly, connect to a web service that exposes access to it remotely.
There are a few of these that already exist. Sitecore itself exposes one, Sitecore Rocks has one, and Hedgehog TDS has one too. And you can always write your own (since any web service running inside the Sitecore ASP.Net app can make database calls and report values back and forth - just remember to consider security if this web service might end up exposed externally for any reason)
John West links to some relevant stuff here:
http://www.sitecore.net/Learn/Blogs/Technical-Blogs/John-West-Sitecore-Blog/Posts/2013/09/Getting-Data-Out-of-the-Sitecore-ASPNET-CMS.aspx
-- Edited to add --
I've not found the blog post I remember. But I came across this SO thread:
Accessing Sitecore API from a CLI tool
which refers to this blog post:
http://www.experimentsincode.com/?p=232
which I think gives the info you'll need for option 1.
(And it reminds me that, of course, when you copy the config stuff you have to copy the Sitecore binaries into your app's folder as well)
I would just like to expand on #JermDavis' post and note that Sitecore isn't a big fan of being accessed when not in a web application. However, if you still want to do this, you will need to make sure that you have all of the necessary configuration settings from the web.config and App_Config of your site in your console application's app.config file.
Moreover, you will never be able to call Sitecore.Context in a console application, as the Sitecore Context sits on top of the HttpContext which means that it must be an application and have a valid request for you to use it. What you are looking for is something more along the lines of Sitecore.Configuration.Factory.GetDatabase("master").
Good luck and happy coding :)
This sounds like a job for the Sitecore Item Web API. I use the Sitecore Item Web API whenever I need to access Sitecore data from the master database outside the context of the Content Management server or outside of the context of the Sitecore application. The Web API definitely does not allow you to do everything that the standard Sitecore API does but it can act as a good base and I now extend upon the Web API instead of writing my own custom web services whenever possible.
Thanks to JemDavis's advise.
After I copied the configuration and made changes to config section to get rid of conflicts. I copied almost all of Sitrecore, analytics and lucene dlls, it worked great.
Only thing you have to remember is, copy the app_config folder to the same location where your dlls are.
Thanks again JemDavis....

Using Lightswitch with my own Domain object : missing reference

I'm working on an asp.net application. I have a Domain assembly (containing mostly command and queries code), a Domain.Contract assembly ( containing mostly the domain objets), a Repository (called by the Domain) and the Web site.
For some specific backoffice needs, I want to create a Lightswitch application. I want to use my current domain as a datasource. I added a WCF Ria Service class Library, and in the RiaService.Web project, added a class based on DomainService, with one query method. Nothing more (no entities, since they are in my Domain.Contract assembly)
Using help from here (thanks Michael W), I was able to add the datasource, and to get my domain object recognized as an entity in light switch.
But, I now have a compile error : 'The type or namespace name 'MyDomain' could not be found in the global namespace (are you missing an assembly reference?)' in the project ServerGenerated.
The specific error is on this line :
global::Domain.Contract.MyObject result = new global::Domain.Contract.MyObject();
which is on of my domain objects (created in my Domain.Contract assembly).
So, it seems that the only thing I need to do is to add a reference do Domain.contract to the ServerGenerated project.
But it does not appear in Visual Studio. Adding my reference to the Server project does not fix the error.
Thanks.
In your solution explorer windows, select the ServerGenerated assembly and click on the "show all files" button. This will show all hidden folders - including the generated client code for WCF Ria.
If there's no generated code this means there's either something wrong with the service implementation (typically you'd get a compilation error) or there's something else wrong with the service - like a missing [EnableClientAccess] attribute (I know for a fact that a service without this attribute does not generate client code).
Other things to check for is to include the server-side ria assembly in your host project + have a correct configuration for WCF ria in the .config file (ask google).
In your solution explorer windows, select the project and click on the "show all files" button and also select the "file view" (not the logical view).
Then add the reference to the projet "ServerGenerated" (not the server project)

Do I understand the "data flow" ib data-driven app for WP7 right?

it's last question, I guess.
One more time - I need to:
Get some piece of data from server to client with WP7.
Change data on a client in offline mode.
Send and submit changes on server.
After digging the net - i got next:
On a server side I have:
Entity framework --> WCF RIA
On a client side I have:
WCF RIA proxy classes --> (???????)-->db sterling -->USER UI-->
-->(changing data)-->db sterling-->(????????)-->WCF RIA proxy classes
So, question is - can I:
1. Can I DETACH WCF RIA proxy objects from context
Save (serialaze) it in sterling
Change it in USER UI
Save changes in sterling again
And then restore (deserialaze) changed objects from sterling
ATTACH restored objects to context and then - save changes in main database?
In other words - can I operate directly with WCF RIA proxy classes on client-side
(store-->change-->restore), and don't create any "support and translating" classes on a client-side?
Thanks.
P.S. May be that scheme is too complex? For this kind of app, I mean.
You should have a look at the RiaServiceContrib project in CodePlex at: http://riaservicescontrib.codeplex.com/
This library gives you the tools you require to take entities offline, save them to Isolated Storage, load them back, change them, save them again, etc. and then eventually to resubmit them back to the service through the context when you are back online.

Resources