You are not logged in.
Sure; I just made a Github GIST:
https://gist.github.com/JavierusTk/04ab … 47f7344ef8
The conditionals are the ones created by Delphi itself; I have mORMot2 repo cloned at W:\mORMot2, and my DPK stored elsewhere, so you'll need to replace my paths with yours
I've not included mormot.db.rad.nexusdb.pas, mormot.db.rad.bde.pas nor mormot.db.rad.firedac.pas, so it will not require the Delphi packages for BDE, NexusDB or FireDAC
I have Delphi Professional here, and I use UniDAC instead of FireDAC
The package has some time, so I propably have left outside a bunch of newer units, but as I don't use them, it's not a problem for me
Let me know if you have any problem
I remember this statement on StackOverflow: "Unless you want to use optional plugin modules, using runtime packages will almost certainly make your life much harder. – David Heffernan Commented Jan 25, 2017"
What I understand is that the mORMot core should better be in a single package, to avoid issues.
I've always used packages with Delphi (since D3), as I only work with one app (and ERP), and it was designed from start with the plugin idea in mind. Never had issues with packages
The only thing I don't know about are threadvars: if they are not a problem, then anything else is not a problem, and you can split mORMot2 in as many pacakges as you wish
I have a big package with all the mormot2 units on it
I don't have any multithreading knowledge, and so don't know if the threadvars will work properly on a package. I suppose they will, but as I said, I can't really judge
Thank you; it does compile perfectly
I didn't understood you, but finally did
So we can not compile mORMot2 as-is in a package and use it safely?
Please, excuse my newbieness in this respect... Does it mean threadvars inside packages are "safe" if they are declared inside the implementation?
Because all the threadvars in mormot2 are declared inside the implementation, so unless you modify the mormot2 sources, they would be safe
In practice, what does it mean with "do not..."?
Sincerely, I lose myself inside mORMot
I do know many people in Delphi looks for websockets libraries, and find only a commercial one (esegece), and an open repo on GitHub, that seems not fully complete
Then I think mORMot has websockets implemented, but I don't really know if it can be used "detached" from the REST/HTTP/ORM stuff
At embarcadero website there is a post one an example using esegece websockets, just a simple chat:
https://blogs.embarcadero.com/example-w … plication/
I know there are examples in mORMot2 using interfaces, but I believe that would not be inbteroperable with other languages/platforms that also have websockets implemented (i.e. javascript)
Is it possible doing it as easily in mORMot? Obviously without non-visible components, but code-created Delphi classes
@ab, the following is a copypaste of an Ian Baker post on the Delphi Developers Telegram group:
Ok, so I went to sleep - and when I woke up there were a few questions asked of me ?
Let me try and respond to the topics to which they apply..
mORMot. It was submitted (and listed) for RAD Studio 10.2, 10.3, 10.4, and "Delphi 7 up". This was before I came to work for Embarcadero so I was not involved in that process.
It was *not* submitted by the project maintainers, we (actually an MVP) proactively listed it as far as I can see.
Since that time we've not had any resubmission or direct submission by the maintainers of the project.
If someone from that project wants to submit it to GetIt I will look over it myself and discuss it with the review team. If there is a reason why it can't be listed - and right now I am definitely not aware of one - then I'll get back to the maintainers and let them know and see what, if anything, can be done to resolve the situation.
I honestly can't see why it would be a problem though - maybe I am missing something?
Submission link is here: https://getitnow.embarcadero.com/submit/
Feel free to email me when the submission goes through although I will receive a notification anyway.
Discussion was https://github.com/synopse/mORMot2/issues/304
What about the repositories content?
What about the repositories naming?
In my opinion, the first should be identifying the repositories content. I've been checking for unit cycles, and there are very few, which means that will not be a restriction on deciding how to split
I'll keep studying your code structure to see what can I hint
mORMot won't be ever on GetIt. It does something strictly forbidden: "adding Client Server technology to Professional"
However if it's split in smaller repos, building ones on top of the others, I believe a good part of it could be there. And that could lead those repo users to the whole mORMot 2
I've been following some comments on mORMot2 GihHub, and could not resist to comment, here
Sure, mORMot2 is not a big monolith, it's carefully architected from a RTL++ to full toolset, and then more
But from outside, to a stranger, it seems... a big monolith. Heck, nobody would think on mORMot if looking for a JSON lib, or crypto, or sockets, websockets, a million stuff. Because it's an ORM, you know, it says it on the name, mORMot
It's very sadthat such an engineering feat as mORMot is not massively used, be it for REST, for ORM, for RTTI, for JSON, for.... ... ...
Spliting it on a few repos *might* be what is needed to make it more used. The higher level repos would use the lower level ones; zero changes on the current code: just a division on more manageable chunks
Just my 2 cents
mORMot 2 has still not reached release status?
@ab, Will it be released in EKON 26?
What would you mean by validating it?
Compiling and running the tests would be of any help at all?
I do have Delphi Professional installed and current, but as of today all my development is still D2007/Win32 focused. Working my way towards
the mORMot2 cross platform units, are compatible with Delphi FMX, for Android target?
Out of the cross platform units, is there something else from mORMot 2 compatible with Delphi FMX android?
I have renamed the constructor as CreateEx().
Thank you! Now compiles fine
Did you try to define the PUREMORMOT2 conditional?
Yes, it was the first I tried, with same result: hangs
I am afraid there will be other issues with Delphi 2007 in other part of the framework.
I download and compile mORMot2 repo almost every day; no problems so far; will report whenever I find any other trouble
Using packages is not the best way of having a stable solution on Delphi.
Unfortunately, I can't change that
Hi ab,
Could you tell me if you are considering these changes?
If you are, I will wait
If you are not, I will make a patcher for me, so I can keep loading your changes through GitHub
Thank you!
With D2007, If you put mORMot2 in a single package and try to compile it, it will hang
if you break it in a bunch of packages, some will hang when compiling
TRawUtf8List.Create([])
Somehow, the compiler can't handle it correctly
The only solution I've seen is changing in TRawUtf8List this declaration :
constructor Create(aFlags: TRawUtf8ListFlags); reintroduce; overload;
with this this one:
constructor CreateWithFlags(aFlags: TRawUtf8ListFlags);
And using the declaration with parameters in the less than one dozen places throught all the mORMot2 code
Idk if it's acceptable or not; if you think it is, I'd make a pull request with the changes
@Javierus do you have a link to the .mobi or .epub version of the docs?
I'm sorry, but I can't publish it: it is ab's intellectual property
The much excellent "Calibre", it's an open source piece of art, a do-it-all tool to handle eBooks, from library handling to eBook reader sync
I browsed to the documentation page, and just downloaded it as plain html. Then droped the file on Calibre
Right clic on it, chose "Covert book", and then the first option (don't know the english caption, but it's not the bulk one)
There I just chose one thing: on "Page Configuration" I chose "Kindle" in both "Input profile" and "output profile". It was a random decision; don't know if it's needed at all
And "OK"
There is a load of stuff you can customize, but I didn't use it
Just downloaded the current mORMot documentation mega-webpage, and converted it to MOBI format, to see if it was readable on a Kindle
To my surprise, Calibre did an excellent job, and all the internal links work on the ebook
The documentation, as an ebook, is very good; I'm going to read it all
Arnaud, thanks again for your awesome mORMot
What do you mean by "load a package"?
I guess you don't mean "downloading" a package from a central repository.
I guess you mean "link" the bpl and its dependencies from the path.
Delphi Help:
function LoadPackage(const Name: string): HMODULE; overload;
function LoadPackage(const Name: string; AValidatePackage: TValidatePackageProc): HMODULE; overload;
Then a single exe is even faster and safer, and will use less resources than a set of bpl.
Ensure you understand what I wrote above about exe being "mapped" into RAM on demand on modern OS.
Ofcourse, I know I would get more speed and less resource usage.
So, you should ensure you understand that I might have a reason to not removing the checkmark on "Build with Runtime packages"
Yes, I understand it absolutely. And I keep the checkmark because the value it gives me is much higher than the pros of the single exe
Edit: I never use packages on the path; I always install the auto-loaded packages in the exe folder
When you say you load the mORMOt package when needed, are you saying that load the mormot package dynamically, and not as runtime pakage?
I'm also a heavy user of runtime packages, wich means the only job my exe has is loading the main bpl: in my case that bpl is just a framework wich will load the appropriate app bpl's
When you start the exe:
* it might have some runtime packages wich will load automatically
* it loads dynamically the main BPL
* loading the main BPL will load automatically the needed packages
* then it will decide wich packages it must load: there is no real applicacion loaded so fa
* Sort them based on package dependencies
* Load and initialize dynamically each package (wich will load more runtime packages automatically)
Guess that's what he refers to with "loaded when needed": if you load a package that uses mormot.bpl , and it was not already loaded, then will load it
Ofcourse you could go with a system that registers packaged stuff on a bpl, and automates loading it automatically when the bpl is used, but so far I've never needed it
* Clean D2007 install
* Clean computer
* New package
* without DCUs, .local, .identcache
it happens few, random times
But if I make a package with all three of mormot.core.mustache, mormot.db.sql,mormot.net.rtsphttp.pas, and any other units you want, it compiles fine
Following this rule and recreating the *.dpk and *.dproj on the first computer, it all works fine
So this "issue" is SOLVED
@mpv
D2007: removing refactoride100.bpl does not change anything
@ab
placing a good part of mormot2 units in a single package fixes all for me. The remaining units will work no matter how you do it: in that same package, or in a bunch of other packages
I do need packages, as in no-go if it doesn't work inside one
Why? My only app is an ERP, where everything is in bpl's. It's heavily customizable via packages: the customers that need customizations, have a package,a bpl, wich integrates perfectly with the program, to the point you can't tell what is "native" and what is not. Form and datamodule inheritance allows to change standard behaviours, if that is needed. And so on...
In short: yes, packages have a place in this world. Perhaps not in the microservices world, but for now that's not my world anyway
I've never used the command line compiler; at least I don't remember doing it in the last 20 years. If you paste here the exact command line you have used, I can try it here
Btw, editing the mormot.net.rtsphttp.pas from the IDE, and then closing the file, was also hanging the whole D2007 IDE
I'm slicing mORMot2 on a bunch of packages, targeting the maximum division possible, at least at start. So far it worked fine, although a few lines must be changed by hand in one unit
If anyone is interested, please drop me a line
If you try to compile \mORMot2\test\mormot2tests.dpr, D2007 IDE compiler will hang in mormot.core.mustache.pas
It's not the project: when trying to anything that uses any of:
mormot.core.mustache.pas
mormot.net.rtsphttp.pas
mormot.db.sql.pas
the D2007 IDE compiler will hang
I don't know if there are more units that hangs
If it is worth anything: investigating the problem on mormot.net.rtsphttp.pas, I found the problem related to the class field:
fPendingGet: TRawUTF8List;
any line using it would hang the compiler, except for the declaration itsef, and fPendingGet.Free
Hope it helps
But the problem is the input... In MVVM, the view is bound to properties on the VM, and that binding must be bidirectional, unless it's just a report or something as that, wich is not the MVVM target
The view is expected to be codeless or as near to it as possible, and to alter the VM just through binding (and actions to a lesser degree)
the difference between MVC and MVVM is more about marketing and actual implementation details than a real design disruption.
I don't understand
IMHO, MVVM is not the same as MVC; for what I'm learning, MVVM gives a bigger decoupling than MVC: The VM should know nothing about the View. The view should be linked to the VM only through property binding and parameterless actions
I believe that the difference exists; MVVM might have started from MVC or MVP, but they are not the same
Could you please help me a bit more, to understand how to use MVVM with mORMot?
@ab ?
Is for real the MVVM in the documentation, or a typo?
What do you do from the begin/end thread? Open and close the connection?
Does the datamodule host all the app tables and business rules?
Reading the documentation, it talks about MVC and MVVM
Implementing MVC with mORMot services seems clear
But... MVVM? As I understand it, MVVM is heavily based on binding properties from the View to the VM. That means any change on a View property must be transferred to the VM. And also de opposite: any change on the VM must be transferred to the View
I can not see how it can be done
Is there any example somewhere?
Thanks
I don't know if this is right or not, but removing the SynUnicode Trim version and the overload qualifier, it compiles fine
function Trim(const S: SynUnicode): string;
Hello,
In today's refactoring, compiling SynCommons with D2007 stops with this error:
[DCC Error] SynCommons.pas(24041): E2251 Ambiguous overloaded call to 'Trim'
The offending line is:
function TrimU(const S: RawUTF8): RawUTF8;
begin
result := Trim(s); <------
end;
@radexpol our app is a VCL monolith, there are no tiers: refactoring that to a n-tier cross platform is our goal
We are going for a MVVM approach there
Back to plugins: the exe just loads the main bpl, wich provides most of the erp-agnostic services: base form classes, security, automation, reporting, everything
The whole ERP is in fact a bunch of plugins that use the basic classes and services, and offer new classes and services to anyone that needs them
There are more ERP plugins providing major (ie. Manufacturing) or minor functionality, and the customer plugins, wich again can be major (ie.airport handling) or minor (ie.integration with a customer web)
All this depends heavily on sharing classes between plugins, and that is natural with BPL
I don't have any idea on how to do that without BPL. To be honest, I never had any need to restrict myself to DLL
You are forgetting we have bpl
I have a standard ERP, and for the few customers with non standard needs we make modules (packages) that plug in the system, using all standard stuff, and adding or overriding any functionality
I'm starting with mORMot, so I'm just making some packages with the sources, wich works fine
Drawback: when you build a new version, you need to rebuild the customer packages as well
Could you please update us when any part of mORMot 2 is production ready?
Thank you very much; that has helped me a lot
In mORMot, do you use triggers and all other SQL stuff, or you should do it in Delphi?
I'm not asking if you can do it, but if you are expected to do it
mORMot has many useful libraries merged, and I understand mORMot2 will try to somehow break them down in diferent units
I think that maybe some libraries get "finished" much earlier than others
Is it possible to have an updated list with the "finished" ones?
As an example, I believe JSON handling will get the finished status way earlier than others
@Javierus "split the project in subprojects"... in fact I was going into the opposite direction.
A lot of units will always be shared among projects.
And due to that, we have regularly a lot of problems with users having e.g. SynCommons.pas from SynPDF project and mORMot project in their path, and failing to compile.
So my idea would be to remove separate projects, and download and use mORMot as main source. If units are refactored into smaller and well-scoped units, it would be just fine to use only SynPDF or SynMustache and not the REST/ORM/SOA part.
I still advocate for this... But not replicating all the code on each repository; what I suggest (from the ignorance) is having side-by-side repositories, with "Core" repository(es) used by the other repos. It's not uncommon to see a repo that needs another repo from the same author, or even needs Spring4D or whatever else
All in a single repository, even if it's easy to use just a part of it, will scare devs. And not only newbies. (Do we still have newbies in Delphi?)
First: The blog topic has fooled some people: yesterday I was told that you were dropping Delphi and keeping only FPC.
1) Compiler versions: whatever you decide will be fine. Myself, just finished migrating from D5 to D2007, and halfway from D2007 to D10.3.3
2) Non-visual components: a must te get more users onboard
3) Spliting units: Bravo! Right now loads of wonderful stuff is lost there
4) Spliting documentation: from mobile devices is very very difficult loading the current page; many times I just can't load it all. There is even a chinese page that uses your documentation page as demonstration for a web client library performance
Please, please, split the project in subprojects that will give both more visibility and more users. Right now I've started to use just your JSON library, but it took with it a load of unrelated stuff. Make it so you have, say, "Core", "JSON", "Mustache" and all the great stuff.
You will have perhaps 5 or 20 subprojects, that will attract developers by themselves. Each repo will get people looking for that specific stuff, and once they are onboard, it's way easier they are interested on the other stuff
I'm probably wrong, but I believe spliting and decoupling your repos will boost very much the mORMot family
Standard troll behavior, of course
OpenSource defines a given software, and has nothing to say about the toolchain
My advice is to use the ORM part as a simple data storage layer only
Now I'm begining to get it; I was absolutely lost.
Thanks for all the advices packed in your answer; will be of great help.
Don‘t rely your business rules on TSQLRecords but on business PODOs. That‘s my advice for building complex servers based on mORMot.
I'm very grateful for your advice, thank you very much.
I've been programming Pascal for 35 years, but I'm the lowest newbie in ORM stuff; so I'm not sure I truly understand you.
Is your advice taking all the mORMot framework, but the ORM part?
Any direction on where to find some information about "Rely your business rules on business PODOs"?
Thanks again, AB
Somehow I missed it; now I've read and on my way to understanding the mechanics
I'm used to put my business logic on the OnBeforePost, OnAfterPost, OnBeforeDelete, and so on.
Where and how should I implement the business logic of objects?
I'm refering not just to field validation, wich currently I implement on the OnBeforePost, but also things as deletion validation (Is acceptable deleting this object?), insert validation, side effects on other objects, and so on.
Hello,
I'm trying to understand how the bussiness rules work in the ORM.
In the case where an article affects other, how can I do it?
Example:
TSQProductRecord = class(TSQLRecord)
private
fReference: RawUTF8;
fName: RawUTF8;
fPrice: Double;
fStock: Double;
published
property Reference: RawUTF8 index 30 read fReference write fReference;
property Name: RawUTF8 index 100 read fName write fName;
property Price: Double read fPrice write fPrice;
property Stock: Double read fStock write fStock;
end;
TSQLMovementRecord = class(TSQLRecord)
private
fIDproduct: TRecordReference;
fDelta: Double;
fDate: TDateTime;
published
property IDproduct: TRecordReference read fIDproduct write fIDproduct;
property Delta: Double read fDelta write fDelta;
property Date: TDateTime read fDate write fDate;
end;
How could I code that Delta should accumulate on the Stock field on the linked Product?
How can I reject a Movement is saved with a non-existent IDproduct?
I have no clue, and am unable to find any info on this topic.
Thanks in advance